Core: Lazyloading with Ionic 3.0

Created on 19 Apr 2017  路  4Comments  路  Source: ngx-translate/core

I'm submitting a ... (check one with "x")

[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[x] feature request

Current behavior
Actually, the translate module can't be used with Ionics 3.0 lazy loading pages (or I'm too stupid to implement that). The docs explain how to setup ngx-translate for Ionic and separately for lazy loading but no guide how to combine these two parts together.

Expected/desired behavior
Update the Docs for Ionics 3.0 lazy loading pages.

  • ngx-translate version: x.x.x
    6.x.x

  • Angular version: 4.0.0

  • Browser: [all ]

Most helpful comment

I found a solution and updatedt also the Ionic docs.
Here is the code for all your page.module.ts files

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { HelloPage } from './hello-page';

@NgModule({
  declarations: [
    HelloPage,
  ],
  imports: [
    IonicPageModule.forChild(HelloPage),
    TranslateModule.forChild()
  ],
  exports: [
    HelloPage
  ]
})
export class HelloPageModule {}

I will create also a PR for the Ionic 2 example in this repo

All 4 comments

I found a solution and updatedt also the Ionic docs.
Here is the code for all your page.module.ts files

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { HelloPage } from './hello-page';

@NgModule({
  declarations: [
    HelloPage,
  ],
  imports: [
    IonicPageModule.forChild(HelloPage),
    TranslateModule.forChild()
  ],
  exports: [
    HelloPage
  ]
})
export class HelloPageModule {}

I will create also a PR for the Ionic 2 example in this repo

@MTechDE Thank you so much!! I was just looking for a solution to this problem today. I just tried it and can confirm it works great. Awesome!

Hi. It doesn't work for me if I try to change the language with translate.use('xx'); inside the lazy loaded module. Any ideas? Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madoublet picture madoublet  路  3Comments

dankerk picture dankerk  路  3Comments

gmquiroga picture gmquiroga  路  3Comments

Snap252 picture Snap252  路  3Comments

guysan picture guysan  路  4Comments