将多个值传递给过滤器angularjs

时间:2016-06-09 23:15:44

标签: angularjs

点击<div>我正在显示特定的<div>并进行一些过滤。我需要在多个值上进行过滤。

在下面的代码中我想要类似

的内容

过滤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 个答案:

答案 0 :(得分: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">