**I'm submitting a issue because since the updated Ionic 3.0.0 the ngx-translate cannot be used with ionic lazy loading system.
Current behavior
When i load the page lazy loaded i get :
Uncaught (in promise): Error: Template parse errors: The pipe 'translate' could not be found (" <ion-header> <ion-navbar color="primary" hideBackButton="true"> <ion-title>{{[ERROR ->]"login.title"|translate}}</ion-title> </ion-navbar> </ion-header> "): ng:///LoginModule/LoginPage.html@8:17
Expected/desired behavior
Reproduction of the problem
Load the webapp using : ionic serve
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
ngx-translate version: 6.0.1
Angular version: 4.0.0
Browser: [all ]
Make sure to import TranslateModule in your lazy loaded module as well. Or better, add TranslateModule to a SharedModule and import that SharedModule to every feature module.
Hi, @SamVerschueren thanks for your reply. i have done your idea + idea based inside issue 209 and it work in dev mode (ionic serve) but when i build for android it dosn't work. Have you tested with ionic run android ?
Have you looked at the AoT section? If yes, provide me with a minimal reproduction case (GitHub repository for instance) and I'll see what I can do. Not much time now to dive into it myself.
Finally i have solved my problem by adding :
// AoT requires an exported function for factories
export function HttpLoaderFactory(http: Http) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
And drawing inspiration from : https://github.com/ngx-translate/core/issues/209
Thanks @SamVerschueren
Glad it worked out :)
I have experienced new problem with lazy loading using ion-tabs component.
Have you experienced this component with lazy loading ?
Thanks
No sorry, haven't used ionic that much. This is an ionic issue so please file an issue over there.
Ok i will do this, have a good day!
Finally is ok for the tabs but you must use lazy for all tab inside pager
@pegaltier Do i have the same question that will let me see your code? please
I thought the IonicPageModule.forChild() function should resolve this ?
If it's loaded in app.module.ts, why should we add it to each page lazy loaded too ?
@pegaltier I got that error but I use lazy loading for all my pages
how do you load the json file in lazyloaded module? i don't see in the network tab the translation
Most helpful comment
Make sure to import
TranslateModulein your lazy loaded module as well. Or better, addTranslateModuleto aSharedModuleand import thatSharedModuleto every feature module.