Created
June 20, 2019 06:38
-
-
Save buildmotion/7898f251656b61ae9227be550c056055 to your computer and use it in GitHub Desktop.
A Configuration service that provides the configuration context to libraries in the application workspace.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, Optional } from "@angular/core"; | |
import { ConfigurationContext } from "./configuration-context"; | |
import { Subject, ReplaySubject } from "rxjs"; | |
import { IConfiguration } from "./i-configuration"; | |
@Injectable({ | |
providedIn: "root" | |
}) | |
export class ConfigurationService { | |
settings$: Subject<IConfiguration> = new ReplaySubject<IConfiguration>(1); | |
constructor(@Optional() context: ConfigurationContext) { | |
if (context) { | |
this.settings$.next(context.config); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment