Created
August 25, 2018 12:37
-
-
Save lydemann/98d5bb93d30a22d2a6d52339d27e6a53 to your computer and use it in GitHub Desktop.
app module with app initilizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function init_app(appLoadService: AppInitService) { | |
return () => appLoadService.init(); | |
} | |
@NgModule({ | |
declarations: [AppComponent, ComponentAComponent, ComponentBComponent], | |
imports: [BrowserModule, CoreModule, HttpClientModule], | |
providers: [ | |
AppInitService, | |
{ | |
provide: APP_INITIALIZER, | |
useFactory: init_app, | |
deps: [AppInitService], | |
multi: true | |
} | |
], | |
bootstrap: [AppComponent] | |
}) | |
export class AppModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment