我有Filtered用户,在过滤一些结果后,但第0个结果是获得点击事件,但其他人没有。并且在某些情况下单击事件以获得未触发的结果。然后我删除了搜索文本,之后过滤的项目将与所有用户一起提供但不可点击。
我不知道为什么,我能解决这个问题,下面是我的代码示例
<input type="text" class="search-presentation form-control" placeholder="Search by Advertiser name" ng-model="searchUserName">
<div id={{"propVal"+$index}} ng-cloak class="advCard" ng-repeat ="userDetails in userList | filter: searchUser | orderBy:'firstName'" style="pointer-events:{{userDetails.active==0?'none':'all'}}; opacity:{{userDetails.active==0?0.5:1}}" >
<div class="leftPanel" ng-mousedown="selectUser(userDetails, $index)">
<div class="trash"><h4 class="advName">{{userDetails.firstName}} </h4></div>
</div>
</div>
$scope.searchUser = function(user) {
var re = new RegExp($scope.searchUserName);
return re.test(user.firstName);
};
$scope.selectUser = function(selectedUser) {
alert("hello" + selectedUser.firstName)
};