Reputation: 5469
ng-disabled not working with $().button('loading') & .button('reset')
. How to fix this issue?
Also I have Plunker.
Upvotes: 0
Views: 1262
Reputation: 1018
You can bind button text to the scope and modify it according to the relevant state.
HTML:
<button id="someButton" class="btn btn-default btn-sm"
ng-disabled="!someArray.someBool" ng-click="someClick()">{{button}}</button>
Before click - Button While loading - Loading... After loading - Loaded
I used a $timeout function of 2 seconds instead of making a real async request. Controller:
$scope.someClick = function() {
$scope.button="loading...";
$timeout(function(){
$scope.someArray.someBool = false;
$scope.button="loaded";
}, 2000);
}
Upvotes: 2