Created
July 31, 2019 19:21
-
-
Save NetanelBasal/ed1c8dbb693203700bfcc2300e84d4c9 to your computer and use it in GitHub Desktop.
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
@Directive({ | |
selector: '[featureFlag]' | |
}) | |
export class FeatureFlagDirective { | |
@Input() featureFlag: string | string[]; | |
constructor( | |
private vcr: ViewContainerRef, | |
private tpl: TemplateRef<any>, | |
private userQuery: UserQuery | |
) { | |
} | |
ngOnInit() { | |
if (this.userQuery.hasFlags(this.featureFlag)) { | |
this.vcr.createEmbeddedView(this.tpl); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment