JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="confirm">
<p>test</p> <a href="#" confirm>click me</a/>
</div>
JavaScript
(function (angular) {
module = angular.module('confirm', []);
ConfirmDirective = function () {
return {
restrict: 'A',
link: function (scope, elm, attrs, ctrls) {
angular.element(elm).bind('click', function (event) {
alert("Sure?");
event.preventDefault();
return false; //or true, depends on you
});
}
};
};
module.directive("confirm", ConfirmDirective);
}(angular));