Angular (v5) service is getting constructed before APP_INITIALIZER promise resolves
问题 I'm expecting Angular to wait until my loadConfig() function resolves before constructing other services, but it is not. app.module.ts export function initializeConfig(config: AppConfig){ return () => config.loadConfig(); } @NgModule({ declarations: [...] providers: [ AppConfig, { provide: APP_INITIALIZER, useFactory: initializeConfig, deps: [AppConfig], multi: true } ] }) export class AppModule { } app.config.ts @Injectable() export class AppConfig { config: any; constructor( private