Skip to content

Instantly share code, notes, and snippets.

@dpalita
Last active August 2, 2018 20:17
Show Gist options
  • Save dpalita/4e814ac43f1b915d9e03e14dc7dddc62 to your computer and use it in GitHub Desktop.
Save dpalita/4e814ac43f1b915d9e03e14dc7dddc62 to your computer and use it in GitHub Desktop.
Trigger an action at app init
@NgModule({
...
})
export class AppModule {
constructor(applicationInitStatus: ApplicationInitStatus,
store: Store<AppState>) {
// dispatch the app init action when all stores have add a chance to rehydrate from indexedDb
applicationInitStatus.donePromise.then(() => store.dispatch(new AppInitAction()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment