How to disable button with Angular?

Spread the love

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.

Leave a Reply

Your email address will not be published. Required fields are marked *