Created
March 13, 2019 08:15
-
-
Save enappd/f675f2596b2f1fd5086a16388d2189c6 to your computer and use it in GitHub Desktop.
Import translation library in Child module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IonicModule } from '@ionic/angular'; | |
import { RouterModule } from '@angular/router'; | |
import { NgModule } from '@angular/core'; | |
import { CommonModule } from '@angular/common'; | |
import { FormsModule } from '@angular/forms'; | |
import { Tab1Page } from './tab1.page'; | |
import { TranslateModule, TranslateLoader} from '@ngx-translate/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; | |
export function HttpLoaderFactory(http: HttpClient) { | |
return new TranslateHttpLoader(http, "./assets/i18n/", ".json"); | |
} | |
@NgModule({ | |
imports: [ | |
IonicModule, | |
CommonModule, | |
FormsModule, | |
TranslateModule.forChild({ | |
loader: { | |
provide: TranslateLoader, | |
useFactory: HttpLoaderFactory, | |
deps: [HttpClient] | |
} | |
}), | |
RouterModule.forChild([{ path: '', component: Tab1Page }]) | |
], | |
declarations: [Tab1Page] | |
}) | |
export class Tab1PageModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment