Skip to content

Instantly share code, notes, and snippets.

@lizzymendivil
Created February 13, 2019 01:47
Show Gist options
  • Save lizzymendivil/d5b14bb5db947364d8831342ccf34016 to your computer and use it in GitHub Desktop.
Save lizzymendivil/d5b14bb5db947364d8831342ccf34016 to your computer and use it in GitHub Desktop.
ngx-translate-app-module
import { BrowserModule } from '@angular/platform-browser';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import { NgModule } from '@angular/core';
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