I would like to disable button after one click.
Code:
<button id="submitRequest" class="btn btn-primary btn-active"
ng-disabled="!frmRequest.$valid||!r.DataUseAgreement||(!chkBMT&&!chkOncore&&!chkCAISIS&&!chkLIMS&&!chkFCR)"
ng-click="SaveData()">
<i class="fa fa-save"></i> Submit
</button>
How to disable this one after one click?
Thanks!
Simple. You write to element a bit of javascript, like onclick="this. disabled=true" . This will disable the button one click,but it doesnt allow form submission too for first click.
How do you hide a button after it is clicked in angular? First set up a Boolean variable for the show hide like public show:boolean = false. Next, set up a function that is tied to the click event of a button or some event on the dom.
Definition and UsageThe ng-disabled directive sets the disabled attribute of a form field (input, select, or textarea). The form field will be disabled if the expression inside the ng-disabled attribute returns true. The ng-disabled directive is necessary to be able to shift the value between true and false .
Simple. You write to element a bit of javascript, like onclick="this.disabled=true"
.
<button id="submitRequest" onclick="this.disabled=true" class="btn btn-primary btn-active" ng-disabled="!frmRequest.$valid||!r.DataUseAgreement||(!chkBMT&&!chkOncore&&!chkCAISIS&&!chkLIMS&&!chkFCR)" ng-click="SaveData()"><i class="fa fa-save"></i> Submit</button>
Disabling button after one click
<input type="submit" name="Submit" class="btn btn-primary"
value="Submit" ng-disabled="button.disabled"/>
In Controller,where u submit the form just add
scope.button={};
scope.button.disabled=true;
This disables the button after one click form submission
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With