You probably did something wrong because it works just fine. According to this question, just use $event.stopPropagation() . Try this script , for example:
<ul ng-app="test" ng-controller="MyCtrl"> <li ng-click="doSomething($event, 1)">One</li> <li ng-click="doSomething($event, 2)">Two <ul> <li ng-click="doSomething($event, 21)">Sub One</li> <li ng-click="doSomething($event, 22)">Sub Two</li> </ul> </li> <li ng-click="doSomething($event, 3)">Three</li> </ul>
and:
function MyCtrl($scope) { $scope.doSomething = function ($event, test) { console.log(test); $event.stopPropagation(); } }
Then click โSub One,โ just show 21 on the console.
source share