[英]Angularjs Nested ng-repeat with conditional caluse
嗨,我有多个ng-repeat被嵌套为
<form ng-repeat="pt in prolist">
Frequency <input type="checkbox" ng-model="pt.req" />
<div ng-repeat="disc in prolist">
------
</div>
</form>
我想做的是这样的
<div ng-repeat="disc in prolist" where pt.id =disc.Pt_id>
请让我知道如何在angularjs中编写这一行代码
您基本上可以将“ where ...”转换为过滤器管道: http : //docs.angularjs.org/api/ng/filter/filter
例如,尝试:
ng-repeat="disc in prolist | filter:{Pt_id: pt.id}" ...
您可以在AngularJS中过滤转发器。 尝试使用过滤器,以下链接显示了如何将过滤器与ng-repeat结合使用。
如果您的数据集很大,则可以使用javascript进行过滤,然后将对象推送到$ scope.prolist以在视图中呈现该视图,因为过滤器对性能的影响很大,但对于较小的数据集来说就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.