Skip to content

Instantly share code, notes, and snippets.

@anjum121
Created December 10, 2015 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anjum121/ead9895708e340fe78b9 to your computer and use it in GitHub Desktop.
Save anjum121/ead9895708e340fe78b9 to your computer and use it in GitHub Desktop.
confirm click
(function () {
'use strict';
angular
.module('c2k')
.directive('ngReallyClick', [ngReallyClickFunction]);
function ngReallyClickFunction() {
return {
restrict: 'A',
link: linkFn
};
function linkFn(scope, element, attrs) {
element.bind('click', function(){
var message = attrs.ngReallyMessage;
if(message && confirm(message)){
scope.$apply(attrs.ngReallyClick)
}
})
}
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment