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.
Written by Aditya Saxena
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#