gpt4 book ai didi

javascript - ng-重复 |过滤器 : Inline inequalities?

转载 作者:太空宇宙 更新时间:2023-11-04 15:07:36 26 4
gpt4 key购买 nike

对于 Angular 的 ng-repeat,我只看到了内联的 equality 过滤器。但是,是否也可以内联不等式?

This fiddle说明了我的问题:

Equality filter works:
<div ng-controller="repeatCtrl">
<div ng:repeat="o in list | filter: id = myPrecious.id">
{{o.id}}:
<input type="checkbox" ng:model="o.checked" />
{{o.checked}}
</div>
</div>

<hr />

Inequality filter does not work:
<div ng-controller="repeatCtrl">
<div ng:repeat="o in list | filter: id != myPrecious.id">
{{o.id}}:
<input type="checkbox" ng:model="o.checked" />
{{o.checked}}
</div>
</div>

The documentation for ng-repeat留下MUCH 不足之处。内联不等式过滤器是否可行?

最佳答案

是的,请看这里:http://jsfiddle.net/DLYys/1/

<div ng-controller="repeatCtrl">
<div ng:repeat="o in list | filter: {id : !myPrecious.id}">
{{o.id}}:
<input type="checkbox" ng:model="o.checked" />
{{o.checked}}
</div>
</div>

关于javascript - ng-重复 |过滤器 : Inline inequalities?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24258673/

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