How to disable a button on a condition?

This perhaps is a better way to disable a button via js. If your button is part of a component, use

<button [disabled]="buttonDisabled">

and in the component class use

this.buttonDisabled = true;

to disable, or

this.buttonDisabled = false;

to enable.

This works now in Ionic version 2.0.0-alpha.57

6 Likes