summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/featureFlag/service/featureFlag.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/featureFlag/service/featureFlag.service.ts')
-rw-r--r--vid-webpack-master/src/app/featureFlag/service/featureFlag.service.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/featureFlag/service/featureFlag.service.ts b/vid-webpack-master/src/app/featureFlag/service/featureFlag.service.ts
new file mode 100644
index 000000000..09ce7bbf5
--- /dev/null
+++ b/vid-webpack-master/src/app/featureFlag/service/featureFlag.service.ts
@@ -0,0 +1,28 @@
+import {ElementRef, Injectable, Renderer2, RendererFactory2} from "@angular/core";
+import {ConfigurationService} from "../../shared/services/configuration.service";
+
+@Injectable()
+export class FeatureFlagService{
+ private features : { [key: string]: boolean } = {};
+ private renderer: Renderer2;
+ constructor(private _configurationService: ConfigurationService,
+ rendererFactory: RendererFactory2){
+ this.renderer = rendererFactory.createRenderer(null, null);
+ this._configurationService.getFlags().subscribe((res: { [key: string]: boolean }) =>{
+ this.features = res;
+ })
+ }
+
+
+ isFeatureOn(feature : string) : boolean {
+ return this.features && this.getFeatureFlag()[feature] === true;
+ }
+
+ getFeatureFlag() : { [key: string]: boolean } {
+ return this.features;
+ }
+
+ hideElement(element: ElementRef) {
+ this.renderer.setStyle(element.nativeElement, 'display', 'none');
+ }
+}