Skip to content

Commit

Permalink
fix(translate): add translate providers in lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Apr 12, 2017
1 parent 4692cae commit 8b0509e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/src/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { Http } from '@angular/http';
import { MaterialModule } from '@angular/material';
import { TranslateModule, TranslateLoader,
TranslateStaticLoader } from 'ng2-translate';

import 'rxjs/add/operator/debounceTime.js';
import 'rxjs/add/operator/distinctUntilChanged';
Expand All @@ -22,6 +25,10 @@ import { IgoQueryModule } from './query/index';
import { IgoSearchModule } from './search/index';
import { IgoSharedModule } from './shared/index';

export function createTranslateLoader(http: Http) {
return new TranslateStaticLoader(http, './locale', '.json');
}

const IGO_MODULES = [
IgoLanguageModule,
IgoFeatureModule,
Expand All @@ -37,6 +44,11 @@ const IGO_MODULES = [
@NgModule({
imports: [
MaterialModule.forRoot(),
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [Http]
}),

IgoCoreModule.forRoot(),
IgoLanguageModule.forRoot(),
Expand Down

0 comments on commit 8b0509e

Please sign in to comment.