Last active
August 29, 2015 14:09
-
-
Save darkmavis1980/3e1cd3620d6c0e4abe9b to your computer and use it in GitHub Desktop.
Confirm before ng-Click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.directive('ngConfirmClick', [ | |
function(){ | |
return { | |
priority: -1, | |
restrict: 'A', | |
link: function(scope, element, attrs){ | |
element.bind('click', function(e){ | |
var message = attrs.ngConfirmClick; | |
if(message && !confirm(message)){ | |
e.stopImmediatePropagation(); | |
e.preventDefault(); | |
} | |
}); | |
} | |
} | |
} | |
]) | |
/* | |
taken from here: http://stackoverflow.com/questions/18313576/confirmation-dialog-on-ng-click-angularjs | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment