gpt4 book ai didi

javascript - ng-option 过滤器不工作

转载 作者:行者123 更新时间:2023-12-03 08:41:27 25 4
gpt4 key购买 nike

我正在尝试使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com