Handling of the "busy" status of a form button, communicating to the user the system is "working" and won't process additional ng-click
events. "busy" state is determined by $scope.isBusy()
which refers to $scope.busy
.
//javascript
controller('ExampleController', function ($scope, $timeout, $q) {
$scope.save = function () {
var deferred = $q.defer();
$timeout(function () {
//do something here
deferred.resolve();
}, 2000);
return deferred.promise;
}
});
//html
<button busy-button busy-text="Saving..." ng-click="save()"></button>
//javascript
controller('ExampleController', function ($scope, $timeout, $q) {
$scope.saveNoPromise = function () {
$timeout(function () {
$scope.busy = false;
}, 2000);
}
});
//html
<button busy-button busy-text="Saving..." ng-click="saveNoPromise()"></button>