我在Angular应用程序中尝试了以下内容:
$(document).on('click touchend', '.dropdown-menu', function(e) {
console.log("Inside....click on");
e.stopPropagation();
console.log("stop..prop");
});
并且即使ng-model值设置为false,我的复选框仍未显示未选中的标记。可能是什么原因?
我的HTML:
function clearAll() {
for (var i = 0; i < vm.list.length; i++) {
if (vm.list[i].flag === true) {
vm.list[i].flag = false;
vm.listFilterCount -= (vm.list[i].value.length + 3);
}
}
vm.listFilterS = '';
vm.count= ' ';
vm.include= [];
vm.list= [];
}
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 borderAtRight"
<!-- Dropdown and Menu -->
<div class="btn-group topFilterCtrl filterDropdn" dropdown dropdown-append-to-body id="ddlStatus">
<div id="btn-append-to-body" type="button" class="btn btn-primary panelTextFont14 noBorder" dropdown-toggle> Status
<span class="caret caretSpan"></span>
</div>
<ul class="dropdown-menu dropDownLabel" role="menu" aria-labelledby="btn-append-to-body" ng-show="!vm.showthis">
<div class="customScroll">
<li role="menuitem" class="changeColorOnHover" ng-repeat="optionThis in vm.List track by $index" ng-show="list.value != null">
<a href="#">
<div class="checkbox" id="{index}" ng-show="this.value != null" ng-click="vm.applyFilterForResultCount()" ng-change="vm.getCount(this)" ng-model="this.flag">
<label>
<input type="checkbox" ng-click="vm.clickStatusCheckBox(this);$event.stopPropagation();" ng-show="this.value != null" />
{{this.value}}
</label>
</div>
</a>
</li>
</div>
<!--Clear div-->
<li role="menuitem" class="btn btn-default buttonli" ng-click="vm.clearAll()">
<a href="#">
<p>
<span class="clearAllBtn">Clear</span>
<span class="dropDownBtnItem"> – All </span>
</p>
</a>
</li>
</ul>
</div>
问题截图: