Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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