Web / Angular Interview questions
What is APP_INITIALIZER in Angular?
APP_INITIALIZER register listeners for the Angular bootstrap process which serves as hooks during Application initialization. This way we can use such hooks to subscribe to the application bootstrap process and perform our initialization logic.
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 an ideal place to perform some initialization logic before the application is initialized.
More Related questions...