I have an attribute directive called userPermission, that is supposed to do some logic and then set the disabled attribute to the element it is attached.
<button userPermission>Disable me with userPermission</button>
<button color="primary" (click)="onNewConfiguration()" userPermission>Add Configuration</button>
<button color="primary" mat-raised-button (click)="onNewConfiguration()" userPermission>Add Configuration</button>
the mat-raised-button
does not work with ElementRef
, or Renderer2
I can not use <button mat-raised-button [disabled]="someVar"></button>
I have to use an attribute directive. and I have tried
this.el.nativeElement.disabled = true;
this.renderer.setAttribute(this.el.nativeElement, 'disabled', 'disabled');
this.el.nativeElement.setAttribute("disabled", "true");
None of these techniques worked.
How can you set a mat-button to disabled using an attribute directive?