import { BrowserModule } from '@angular/platform-browser' ; import { NgModule , APP_INITIALIZER } from '@angular/core' ; import { AppComponent } from './app.component' ; import { AppConfigService } from './app-config.service' ; import { HttpClientModule } from '@angular/common/http' ; export function setupAppConfigServiceFactory ( service ) { return ( ) => service . load ( ) ; } @ NgModule ( { declarations : [ AppComponent ] , imports : [ BrowserModule , HttpClientModule ] , providers : [ { provide : APP_INITIALIZER , useFactory : setupAppConfigServiceFactory , deps : [ AppConfigService ] , multi : true } ] , bootstrap : [ AppComponent ] } ) export class AppModule { }