Angular: How to correctly implement APP_INITIALIZER

Due to how APP_INTIALIZER works, it’s expected that asynchronous initializers return promises, but your implementation of APP_INTIALIZER multiprovider doesn’t because loadConfigurationData function doesn’t return anything.

It should be something like:

loadConfigurationData(): Promise<Configuration> {
  return this.http.get<Configuration>(`${this.originUrl}${this.configUrlPath}`)
  .do(result => {
    this.configData = result;
  })
  .toPromise();
}

Leave a Comment