Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghoul007/providers_angulars
APP_INITIALIZER
https://github.com/ghoul007/providers_angulars
Last synced: about 1 month ago
JSON representation
APP_INITIALIZER
- Host: GitHub
- URL: https://github.com/ghoul007/providers_angulars
- Owner: ghoul007
- Created: 2019-09-18T21:03:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T09:51:20.000Z (about 2 years ago)
- Last Synced: 2024-04-24T10:24:15.185Z (9 months ago)
- Language: HTML
- Homepage:
- Size: 1.87 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# APP_INITIALIZER
The APP_INITIALIZER is an instance of InjectionToken. It is a built in Injection token provided by Angular.
The Angular will execute the function provided by this token when the application loads. If the function returns the promise, then the angular will wait until the promise is resolved. This will make it ideal place to perform some initialization logic before the application is initialized.
declare in module file
```js
providers: [{ provide: APP_INITIALIZER, useFactory: InitializeApp, deps: [ConfigService], multi: true }],
```'configService.load()' returns promise type, either resolve to continue the execution or stop in the case of reject
```js
export function InitializeApp(configService: ConfigService): () => Promise {
return () => configService.load();
}
```