Created
August 25, 2018 12:36
-
-
Save lydemann/0332b8a2229e86e7644843b8dff17914 to your computer and use it in GitHub Desktop.
App init service for loading feature flags
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
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class AppInitService { | |
constructor(private httpClient: HttpClient, private featureToggleService: FeatureToggleService) {} | |
public init() { | |
return this.httpClient | |
.get('assets/feature-config.json') | |
.pipe(tap((features) => (this.featureToggleService.features = features as any))) | |
.toPromise(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment