2016-06-09 62 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"> 
相關問題