Last active
August 2, 2018 20:18
-
-
Save dpalita/4e23765d38d63f28324166fa68730124 to your computer and use it in GitHub Desktop.
Provide promises to the angular APP_INITIALYZER to put application initialization on hold
This file contains hidden or 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 accountReducerBootstrapFactory(reducer: AccountReducer) { | |
// bootstrap() returns a Promise | |
return () => reducer.bootstrap() | |
} | |
@NgModule({ | |
... | |
providers: [ | |
{ | |
provide: APP_INITIALIZER, | |
deps: [AccountReducer], | |
multi: true, | |
useFactory: accountReducerBootstrapFactory | |
} | |
] | |
... | |
}) | |
export class AccountModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment