Enable button to toggle


#1

Hi,
I’m doing a form that it has a toggle and a button, I want that when the toggle is true, the button will be enabled and when I change toggle to false the button will be disabled

how this can be done.

Thanks in advance


#2

You probably already have the toggle bound to a property in the component. Just use that:

<button [disabled]="!toggleState">