2016-06-09 71 views
0

单击某个<div>我正在显示一个特定的<div>并执行一些过滤。我需要过滤器发生在多个值上。将多个值传递给过滤器angularjs

在下面的代码我想是这样

过滤if evaluationStatusId == 11 or 12

HTML:

<div style="font-size:40px;margin-top:10px" ng-click="clickedStatus='9'"> 
            {{Approved}} 
</div> 
<div style="font-size:40px;margin-top:10px" ng-click="clickedStatus='10'"> 
            {{submitdMissnDocs}} 
</div> 
<div style="font-size:40px;margin-top:10px" ng-click="clickedStatus='11 || 12'"> 
            {{Denied}} 
</div> 

<div class="row" name="empList" id="empList" ng-show="clickedStatus"> 
<table class="table table-bordered table-striped"> 
<tbody> 
<tr ng-repeat="emp in Summary.CorpEmployees | filter: {locationId:selectedItem.Label} | filter: {evaluationStatusId:clickedStatus}"> 
</tbody> 
</table> 
</div> 

回答

1

可以使用filter功能是这样的:

$scope.myFilter = function(emp){ 

    return emp.locationid === $scope.selectedItem.Label || emp.evaluationStatusId === $scope.clickedStatus; 

}; 

所以你重复表达将是:

<tr ng-repeat="emp in Summary.CorpEmployees | filter: myFilter">