Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created August 25, 2018 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydemann/0332b8a2229e86e7644843b8dff17914 to your computer and use it in GitHub Desktop.
Save lydemann/0332b8a2229e86e7644843b8dff17914 to your computer and use it in GitHub Desktop.
App init service for loading feature flags
@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