how can I dynamically add an *ngIf to an element that's decorated with an attribute directive?
For a simple experiment, I tried this:
@Directive({
selector: '[lhUserHasRights]'
})
export class UserHasRightsDirective implements OnInit, OnDestroy {
constructor(private el: ElementRef) {
}
ngOnInit(): void {
this.el.nativeElement.setAttribute("*ngIf", "false");
}
...
, but it didn't work. The browser showed me an error "ERROR DOMException: Failed to execute 'setAttribute' on 'Element': 'ngIf' is not a valid attribute name."