UNPKG

@dagonmetric/ng-config

Version:

Configuration and options service for Angular applications.

80 lines 2.54 kB
/** * @fileoverview added by tsickle * Generated from: http-config/src/http-config-provider.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright DagonMetric. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found under the LICENSE file in the root directory of this source tree. */ import { HttpClient } from '@angular/common/http'; import { Inject, Injectable, Injector } from '@angular/core'; import { HTTP_CONFIG_PROVIDER_OPTIONS } from './http-config-provider-options'; import * as i0 from "@angular/core"; import * as i1 from "@angular/common/http"; import * as i2 from "./http-config-provider-options"; /** * Implements an HTTP client API for HttpConfigProvider that relies on the Angular HttpClient. */ export class HttpConfigProvider { /** * @param {?} httpClient * @param {?} injector * @param {?} options */ constructor(httpClient, injector, options) { this.httpClient = httpClient; if (typeof options.endpoint === 'string') { this.configEndpoint = options.endpoint; } else { this.configEndpoint = injector.get(options.endpoint); } } /** * @return {?} */ get name() { return 'HttpConfigProvider'; } /** * @return {?} */ get endpoint() { return this.configEndpoint; } /** * @return {?} */ load() { return this.httpClient.get(this.configEndpoint); } } /** @nocollapse */ HttpConfigProvider.ɵprov = i0.ɵɵdefineInjectable({ factory: function HttpConfigProvider_Factory() { return new HttpConfigProvider(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(i2.HTTP_CONFIG_PROVIDER_OPTIONS)); }, token: HttpConfigProvider, providedIn: "any" }); HttpConfigProvider.decorators = [ { type: Injectable, args: [{ providedIn: 'any' },] } ]; /** @nocollapse */ HttpConfigProvider.ctorParameters = () => [ { type: HttpClient }, { type: Injector }, { type: undefined, decorators: [{ type: Inject, args: [HTTP_CONFIG_PROVIDER_OPTIONS,] }] } ]; if (false) { /** * @type {?} * @private */ HttpConfigProvider.prototype.configEndpoint; /** * @type {?} * @private */ HttpConfigProvider.prototype.httpClient; } //# sourceMappingURL=http-config-provider.js.map