Created
November 29, 2013 17:54
-
-
Save mfrancois/7709526 to your computer and use it in GitHub Desktop.
Angular directive for adding jConfirm into element
This file contains hidden or 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
| angular.directive('ngConfirmClick', [ | |
| function () { | |
| return { | |
| priority: 100, | |
| restrict: 'A', | |
| link: function (scope, element, attrs) { | |
| element.bind('click', function (e) { | |
| var message = attrs.ngConfirmClick; | |
| var title = attrs.title; | |
| var link = attrs.href; | |
| e.stopImmediatePropagation(); | |
| e.preventDefault(); | |
| jConfirm(message, title, function (r) { | |
| if (r !== false) { | |
| window.location.href = link; | |
| } | |
| return false; | |
| }); | |
| }); | |
| } | |
| }; | |
| } | |
| ]); |
This file contains hidden or 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
| <ul> | |
| <li class="iDialog"> | |
| <a href="#" ng-confirm-click="{{langue['wCertification:action:sendtouser:message']}}" title="{{langue['wCertification:action:sendtouser:title']}}"> | |
| <span>{{langue['wCertification:action:sendtouser:button']}}</span> | |
| </a> | |
| </li> | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment