app/app.config.ts
Properties |
|
Methods |
constructor(http: HttpClient)
|
||||||
Defined in app/app.config.ts:7
|
||||||
Parameters :
|
load |
load()
|
Defined in app/app.config.ts:9
|
Returns :
any
|
Static settings |
Type : IAppConfig
|
Defined in app/app.config.ts:7
|
import { IAppConfig } from './models/app-config.model';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class AppConfig {
public static settings: IAppConfig;
constructor(private http: HttpClient) { }
load() {
const jsonFile = 'v2/assets/config/config.json';
return new Promise<void>((resolve, reject) => {
this.http.get(jsonFile).toPromise().then(async (response: IAppConfig) => {
AppConfig.settings = <IAppConfig>response;
resolve();
}).catch((response: any) => {
reject(`Could not load file '${jsonFile}': ${JSON.stringify(response)}`);
});
});
}
}