I'd like to know whether it's possible to remove Angular expressions dynamically. I tried the following without any success:
My button
<button myDirective [disabled]="someExpression">Clippy</button>
My Directive
@Directive({
selector: '[myDirective]'
})
export class MyDirective {
constructor(private element: ElementRef) {}
ngOnInit() {
this.element.nativeElement.removeAttribute('disabled');
}
}
The problem
Initially the button won't be disabled, but once someExpression re-evaluates it'll add the disabled attribute back to the element.
Just for clarification, I want to remove an Angular expression dynamically. In the above example it's [disabled]. But this can be any binding in the future. I want my directive to overrule the existing binding.
@Inputproperty to the customdirectiveand achieve this