Skip to content

Instantly share code, notes, and snippets.

@dancornilov
Last active March 26, 2019 13:17
Show Gist options
  • Save dancornilov/2b6a0caad10374fdede1a8d31aa42bb5 to your computer and use it in GitHub Desktop.
Save dancornilov/2b6a0caad10374fdede1a8d31aa42bb5 to your computer and use it in GitHub Desktop.
Module with translation configuration
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