I know that question is pretty old, however the directive below binds a click event handler which prevents the call of the function binded to ng-click on the same html element.
The keys are:
priority: -1
: since ngClick has a priority: 0
, our directive's link (post-link) function will be executed after ngClick link function, as stated in angular docs:
Directives with greater numerical priority are compiled first.
Pre-link functions are also run in priority order, but post-link
functions are run in reverse order. The order of directives with the
same priority is undefined.
e.stopImmediatePropagation();
As stated in JQuery docs:
In addition to keeping any additional handlers on an element from
being executed, this method also stops the bubbling by implicitly
calling event.stopPropagation().
Directive code:
.directive('noClick', [function(){
return {
priority: -1,
link: function(scope, iElem, iAttr){
iElem.on('click', noClick);
function noClick(e) {
e.stopImmediatePropagation();
e.preventDefault();
}
}
};
}])
HTML code
<div no-click ng-click="myFunct()">
Credits to this answer