localize-router
localize-router copied to clipboard
Cyclic dependency error by using three modules: LocalizeRouterModule, TranslateModule, TransferHttpCacheModule
I need to use these three modules in my project: TranslateModule LocalizeRouterModule TransferHttpCacheModule
Somehow these are causing a cyclic dependency error. Also did a post on StackOverflow https://stackoverflow.com/questions/47510536/cyclic-dependency-error-transferhttpcachemodule-localizeroutermodule-translate
And created a plnkr to reproduce this issue: https://plnkr.co/edit/qlUQ866JzTa3JtFgSAIO?p=preview
Hope someone can help me solve this issue.
It's interesting problem. I'll try to assist you as soon as possible.
Not sure why your question got down-voted on stack overflow.
@bobsingor @meeroslav this seems to be a conflict between HttpClientModule and TransferHttpCacheModule.
Take a look at this plunker https://plnkr.co/edit/7Plnvz?p=preview Still don't know the solution for this yet.
Still don't know the solution for this yet.
I guess no. It working only if TranslateModule.forRoot() stay empty.
I think this issue is related to AOT compiler.
I can avoid Cyclic dependency error using the following ParserLoader and setting the translate property before init method through Injector. The only problem is that the translate property in LocalizeParser need to be protected, not private.
export class ManualParserLoader extends LocalizeParser {
constructor(private injector: Injector, location: Location, settings: LocalizeRouterSettings, locales: string[] = ['en'], prefix: string = 'ROUTES.') {
super(null, location, settings);
this.locales = locales;
this.prefix = prefix || '';
}
load(routes: Routes): Promise<any> {
return new Promise((resolve: any) => {
this.translate = this.injector.get(TranslateService);
this.init(routes).then(resolve);
});
}
}
I'm sure there is a better solution, any suggestion?
any solution for solve this ?
Same issue over here :(
Need help for this one too
I have the exact same problem, is there any solution to fix it ?
Same issue, any solution ? :)
up