-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.module.ts
More file actions
33 lines (29 loc) · 933 Bytes
/
Copy pathapp.module.ts
File metadata and controls
33 lines (29 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { BrowserModule } from '@angular/platform-browser';
import { NgModule , APP_INITIALIZER } from '@angular/core';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { TranslateService } from './translate.service';
import { TranslatePipe } from './translate.pipe';
import { AppSettings } from '../AppSettings';
import { CanActivateRouteGuard } from './can-activate-route.guard';
export function setupTranslateFactory(service: TranslateService): Function {
return () => service.use(AppSettings.language);
}
@NgModule({
declarations: [
AppComponent,
TranslatePipe
],
imports: [
BrowserModule, HttpClientModule
],
providers: [ TranslateService,
{
provide: APP_INITIALIZER,
useFactory: setupTranslateFactory,
deps: [ TranslateService ],
multi: true
} ],
bootstrap: [AppComponent]
})
export class AppModule { }