Nov 5, 2024
APP_INITIALIZER
injection token in the application root injector.multi
to true).useValue
or useFactory
).useValue
serves as an example, executing a console log to show the initialization.bootstrapModule
method is called in Angular.BootstrapModule
calls BootstrapModuleFactory
, which runs runInitializers
from ApplicationInitStatus
service.appInits
and executed before the module bootstrapping.take
to complete observables, allowing the application to proceed.donePromise
upon completion of all promises from initializers.Promise.all
to aggregate promises, succeeding when all are resolved.imports
, declarations
), focus on providers
.useFactory
provider, creating a function for initialization.HttpClientModule
and ConfigService
.BehaviorSubject
.BehaviorSubject
to an observable for public access.Deps
property in the factory function.