Skip to content

Instantly share code, notes, and snippets.

@jms
Created January 11, 2017 16:11
Show Gist options
  • Select an option

  • Save jms/cf17451b72e00ef99b2231d6f6947dc1 to your computer and use it in GitHub Desktop.

Select an option

Save jms/cf17451b72e00ef99b2231d6f6947dc1 to your computer and use it in GitHub Desktop.
angularjs prevent double click/double submit
$scope.flag = false;
$scope.buttonClicked = function() {
if ($scope.flag) {
return;
}
$scope.flag = true;
Service.doService.then(function(){
//this is the callback for success
$scope.flag = false;
}).error(function(){
//this is the callback for the error
$scope.flag = false;
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment