Last active
March 26, 2019 13:17
-
-
Save dancornilov/2b6a0caad10374fdede1a8d31aa42bb5 to your computer and use it in GitHub Desktop.
Module with translation configuration
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 { NgModule } from '@angular/core'; | |
import { HttpClientModule, HttpClient } from '@angular/common/http'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; | |
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; | |
import { AppComponent } from './app.component'; | |
export function HttpLoaderFactory(http: HttpClient) { | |
return new TranslateHttpLoader(http); | |
} | |
@NgModule({ | |
declarations: [ | |
AppComponent | |
], | |
imports: [ | |
BrowserModule, | |
HttpClientModule, | |
TranslateModule.forRoot({ | |
loader: { | |
provide: TranslateLoader, | |
useFactory: HttpLoaderFactory, | |
deps: [HttpClient] | |
} | |
}) | |
], | |
providers: [], | |
bootstrap: [AppComponent] | |
}) | |
export class AppModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment