I am would like to configure my Angular 2 App from external json file.
In my main.ts I load the config.json
getHttp().get('/config.json')
.map(response => response.json();)
.subscribe(
data => {
let clientConf: ClientConfig = data;
// here I want to pass clientConf to AppModule
platformBrowserDynamic().bootstrapModule(AppModule);
});
I wonder how to pass clientConf to AppModule to use in app.module.ts:
@NgModule({
...
providers: [
{ provide: Configuration, useValue: clientConf }
...