I updated my project to latest Angular version and also updated the dependencies. The application is running fine now but when I run the tests (ng test) I'm experiencing the following error in my AppComponent (app.component.spec.ts):
Error: StaticInjectorError(DynamicTestModule)[BsDropdownDirective -> ComponentLoaderFactory]:
StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]:
NullInjectorError: No provider for ComponentLoaderFactory!
app.component.spec.ts:
declarations: [
AppComponent,
ForbiddenComponent
],
imports: [
HttpClientTestingModule,
APP_IMPORTS
]
app.imports.ts:
export const APP_IMPORTS = [
BrowserModule,
FormsModule,
HttpClientModule,
RouterModule.forRoot(ROUTE_CONFIG, {enableTracing: false}),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
}
}),
StoreModule.forRoot(reducers),
EffectsModule.forRoot([]),
STORE_DEV_TOOLS_IMPORTS,
ToastrModule.forRoot({
maxOpened: 3,
preventDuplicates: true,
timeOut: 7000,
progressBar: true,
positionClass: "toast-bottom-left",
}),
BsDropdownModule.forRoot(),
DatepickerModule.forRoot(),
TooltipModule.forRoot(),
...
];
also adding BsDropdownModule.forRoot(), directly to app.component.spec.ts imports doesn't help. Any idea?
None
ngx-bootstrap: 3.0.1
Angular: 6.0.6
Bootstrap: bootstrap-sass 3.3.7
Angular CLI 6.0.8
I have this error too.
Does anyone knows any fix?
Only happens in app.component.spec.ts! Other Tests that are using ngx-bootstrap as well work fine
@werthdavid
Please try to provide _BsDropdownModule.forRoot()_ into imports.
Still facing same issue... not working fine
Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]:
StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]:
NullInjectorError: No provider for ComponentLoaderFactory!
NullInjectorError: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]:
StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]:
I had the issue and it was dropdown directive missing from the upper div
Most helpful comment
I had the issue and it was
dropdowndirective missing from the upper div