Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created August 25, 2018 12:37
Embed
What would you like to do?
app module with app initilizer
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