Last Updated: February 25, 2016
·
5.551K
· adityasaxena

AngularJS stop event propagation

In AngularJS context:

If you have the following in your page,

<a ng-click="nextPage($event)">Button</a>

then in your controller, you should say

$scope.nextPage = function($event){
    $event.stopPropagation();
}

I was trying this with jquery like this:

$('selector').on('click', 'target-selector', function(e){
   e.stopPropagation();
});

This just doesn't work because the event has already fired in by the time we check for event propagation.