当我单击其中包含输入的标签时,Agnular的ng-click会触发两次.我试过$event.stopPropagation();但是没有用,怎么解决这个问题:
我也检查了这个问题:
Angular.js ng-click events on labels are firing twice
<div class="list-group-item" ng-repeat="item in model.data"> <form role="form" name="selectForm" novalidate> <label ng-click="$event.stopPropagation(); updateSelected();"> <input type="checkBox" ng-model="chechkedSkins[item.id]" /> <span>{{item.name}}</span> </label> </form> </div>
解决方法
使用ng-change =“updateSelected”
仅在输入上使用此选项,因为即使单击标签也会触发更改.