One of my directives is set up like this:
app.directive('custom', function(){
return {
restrict:'A',
link: function(scope, element){
element.bind('click', function(){
alert('want to prevent this');
});
}
}
});
Yes, using jQuery-style binding is necessary in this case.
Now, I am trying to prevent the event propagation if a certain condition is met.
I attempted to do this:
$event.stopPropagation();
$event.preventDefault();
But unfortunately, it did not work as expected.
Here's an example fiddle for reference - http://jsfiddle.net/STEVER/5bfkbh7u/