Slide 90
Slide 90 text
Dynamic con g
const appInitializerFn = (appConfig: AppConfigService) => {
return () => {
return appConfig.loadAppConfig();
};
};
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
LibToConfigureModule,
HttpClientModule
],
providers: [
AppConfigService,
{
provide: APP_INITIALIZER,
useFactory: appInitializerFn,
multi: true,
deps: [AppConfigService],
},
],
bootstrap: [AppComponent],
})
export class AppModule {}
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
const appInitializerFn = (appConfig: AppConfigService) => {
return () => {
return appConfig.loadAppConfig();
};
};
1
2
3
4
5
6
@NgModule({
7
declarations: [AppComponent],
8
imports: [
9
BrowserModule,
10
LibToConfigureModule,
11
HttpClientModule
12
],
13
providers: [
14
AppConfigService,
15
{
16
provide: APP_INITIALIZER,
17
useFactory: appInitializerFn,
18
multi: true,
19
deps: [AppConfigService],
20
},
21
],
22
bootstrap: [AppComponent],
23
})
24
export class AppModule {}
25
useFactory: appInitializerFn,
deps: [AppConfigService],
const appInitializerFn = (appConfig: AppConfigService) => {
1
return () => {
2
return appConfig.loadAppConfig();
3
};
4
};
5
6
@NgModule({
7
declarations: [AppComponent],
8
imports: [
9
BrowserModule,
10
LibToConfigureModule,
11
HttpClientModule
12
],
13
providers: [
14
AppConfigService,
15
{
16
provide: APP_INITIALIZER,
17
18
multi: true,
19
20
},
21
],
22
bootstrap: [AppComponent],
23
})
24
export class AppModule {}
25