Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created July 31, 2019 19:21
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 NetanelBasal/ed1c8dbb693203700bfcc2300e84d4c9 to your computer and use it in GitHub Desktop.
Save NetanelBasal/ed1c8dbb693203700bfcc2300e84d4c9 to your computer and use it in GitHub Desktop.
@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