Hi!
Is there a way to disable a button after it has been clicked?
<button ion-button color="secondary" (click)="trueclick()">Truth</button>
Hi!
Is there a way to disable a button after it has been clicked?
<button ion-button color="secondary" (click)="trueclick()">Truth</button>
Bind the standard HTML disabled attribute to a variable that is set by your handler. This is done on the Angular side of the app vs. the Ionic side of the app
You mean like this?
HTML:
<button ion-button color="secondary" (click)="trueclick()" {{something}}>Truth</button>
TS:
something;
trueclick(){
this.something = 'disabled';
}
< !-- Bind button disabled state to isUnchanged
property -->
< button [disabled]=“isUnchanged”>Save< /button>
See https://angular.io/docs/ts/latest/guide/template-syntax.html for more on this
Chris
hope this help (see disabled attribute)-
<button ion-button color="secondary" (click)="truthClick()" [disabled]="disableButton">Truth</button>
disableButton;
truthClick() {
disableButton = true;
}
It worked! (don’t forget to put this.
before disableButton
) Thank you very much!