Sometimes, we want to disable button with Angular.
In this article, we’ll look at how to disable button with Angular.
How to disable button with Angular?
To disable button with Angular, we set the [disabled]
attribute.
For instance, we write
<button [disabled]="!isValid" (click)="onConfirm()">Confirm</button>
to set [disabled]
to !isValid
.
isValid
is an instance variable in the component class.
Conclusion
To disable button with Angular, we set the [disabled]
attribute.