File

app/app.config.ts

Index

Properties
Methods

Constructor

constructor(http: HttpClient)
Parameters :
Name Type Optional
http HttpClient No

Methods

load
load()
Returns : any

Properties

Static settings
Type : IAppConfig
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)}`);
			});
		});
	}
}

result-matching ""

    No results matching ""