我正在尝试使用 ng-options 在选择中显示数组中的数据,并且我想过滤它,但它不起作用。我不想显示具有 billHeadShortForm=FEC & FDG 的对象
这是我的 HTML
<select class="form-control" ng-init="getBillHeadCurrentProjWise()" ng-model="headID" ng-options="h.billHeadID as h.billHead for h in billHeadsProjWise | filter:h.billHeadShortForm!='FEC' | h.billHeadShortForm!='FDG'">
<option value="">--Select Billing Head--</option>
</select>
最佳答案
我找到了解决办法
$scope.myFunction = function (Billhead) {
if (Billhead.billHeadShortForm == 'FEC' || Billhead.billHeadShortForm == 'FDG' || Billhead.billHeadShortForm == 'GL') {
return false;
} else {
return true;
}
}
ng-options="h.billHeadID as h.billHead for h in billHeadsProjWise | filter:myFunction"
关于javascript - ng-option 过滤器不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33037826/