Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created August 25, 2018 12:37
Show Gist options
  • Save lydemann/98d5bb93d30a22d2a6d52339d27e6a53 to your computer and use it in GitHub Desktop.
Save lydemann/98d5bb93d30a22d2a6d52339d27e6a53 to your computer and use it in GitHub Desktop.
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