pyc-website

main website for pyc inc.

git clone https://9o.is/git/pyc-website.git

ngReallyClick.js

(496B)


      1 /**
      2  * A generic confirmation for risky actions. Usage: Add attributes:
      3  * ng-really-message="Are you sure"? ng-really-click="takeAction()" function
      4  */
      5 angular.module('ngReallyClick', []).
      6   directive('ngReallyClick', [ function() {
      7 	return {
      8 		restrict : 'A',
      9 		link : function(scope, element, attrs) {
     10 			element.bind('click', function() {
     11 				var message = attrs.ngReallyMessage;
     12 				if (message && window.confirm(message)) {
     13 					scope.$apply(attrs.ngReallyClick);
     14 				}
     15 			});
     16 		}
     17 	};
     18 } ]);