This repository was archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
This repository was archived by the owner on Nov 20, 2018. It is now read-only.
Angular5.2.0, StaticInjectorError(AppModule)[HttpHandler -> Injector] #22
Copy link
Copy link
Open
Description
Hi qjon, I'm having trouble to make it past the dependencies. I've imported all necessary packages in my target module where I'm printing the File Manager:
repository.module.ts
import {FileManagerModule, IFileManagerConfiguration} from '@rign/angular2-filemanager';
import {TranslateModule, TranslateService} from 'ng2-translate';
import {EffectsModule} from '@ngrx/effects';
import {StoreModule} from '@ngrx/store';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {TreeModule} from '@rign/angular2-tree';
import {ConfirmationPopoverModule} from 'angular-confirmation-popover';
...
const fileManagerConfiguration: IFileManagerConfiguration = {
urls: {
foldersUrl: '/api/folder',
filesUrl: '/api/files',
folderMoveUrl: '/api/folder/move'
},
isMultiSelection: true,
mimeTypes: ['image/jpg', 'image/jpeg', 'image/png'],
maxFileSize: 50 * 1024,
allowChooseMultipleFiles: true
}
...
@NgModule({
imports: [
BrowserAnimationsModule,
ConfirmationPopoverModule.forRoot(),
StoreModule.forRoot({}),
EffectsModule.forRoot([]),
FileManagerModule.forRoot(fileManagerConfiguration),
TreeModule.forRoot(),
TranslateModule.forRoot(),
],
...
repository.component.ts
import {FileManagerConfiguration, FileManagerDispatcherService} from '@rign/angular2-filemanager';
@Component({
selector: 'jhi-repository',
templateUrl: './repository.component.html'
})
export class RepositoryComponent implements OnInit, OnDestroy {
constructor (
public fileManagerConfiguration: FileManagerConfiguration,
private fileManagerDispatcher: FileManagerDispatcherService
) {
}
public toggleMultiSelection() {
this.fileManagerConfiguration.isMultiSelection = !this.fileManagerConfiguration.isMultiSelection;
if (!this.fileManagerConfiguration.isMultiSelection) {
this.fileManagerDispatcher.unSelectAllFiles();
}
}
When I remove all FileManager... references from repository.component.ts and both lines FileManagerModule.forRoot(fileManagerConfiguration) and TreeModule.forRoot() from repository.module.ts @NgModule imports the webapp does start with the other dependencies, otherwise I'm getting this error:
app.main.ts?3881:13 Error: StaticInjectorError(EReportAppModule)[HttpHandler -> Injector]:
StaticInjectorError(Platform: core)[HttpHandler -> Injector]:
NullInjectorError: No provider for Injector!
I had to install the http library in @angular/http apart from the standard in @angular/common/http for it to work as ng2-translate needs to import the Http model and module from that location.
Right now I'm completely blocked, I'd really could use a tip.
Metadata
Metadata
Assignees
Labels
No labels