I need the following modules for my project:
TranslateModule LocalizeRouterModule TransferHttpCacheModule
Somehow this combination of modules is creating a cyclic dependency.
TranslateModule with TransferHttpCacheModule - works TranslateModule with LocalizeRouterModule - works
But when I import all three it's causing a dependency cyclic.
Cannot instantiate cyclic dependency! ApplicationRef ("[ERROR ->]"): in NgModule AppBrowserModule in ./AppBrowserModule@-1:-1
Check the plnkr for reproduction of the problem: https://plnkr.co/edit/qlUQ866JzTa3JtFgSAIO?p=preview
@NgModule({
imports: [
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
TransferHttpCacheModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpTranslationLoaderFactory,
deps: [HttpClient]
}
}),
LocalizeRouterModule.forRoot([], {
parser: {
provide: LocalizeParser,
useFactory: HttpLoaderFactory,
deps: [TranslateService, Location, LocalizeRouterSettings]
}
}),
RouterModule.forRoot([])
],
declarations: [
AppComponent
],
providers: [
],
bootstrap: [AppComponent]
}) export class AppModule { }