UNPKG

@ngx-config/http-loader

Version:

Loader for ngx-config that provides application settings using http

24 lines (21 loc) 834 B
import { __decorate, __param, __metadata } from 'tslib'; import { HttpClient } from '@angular/common/http'; import { resolveForwardRef, Inject, forwardRef } from '@angular/core'; let ConfigHttpLoader = class ConfigHttpLoader { constructor(http, endpoint = '/config.json') { this.http = http; this.endpoint = endpoint; } loadSettings() { return new Promise((resolve, reject) => { const http = resolveForwardRef(this.http); http.get(this.endpoint).subscribe(resolve, () => reject('Endpoint unreachable!')); }); } }; ConfigHttpLoader = __decorate([ __param(0, Inject(forwardRef(() => HttpClient))), __metadata("design:paramtypes", [HttpClient, String]) ], ConfigHttpLoader); export { ConfigHttpLoader }; //# sourceMappingURL=ngx-config-http-loader.js.map