繁体   English   中英

如何在Angular.Dart中通过布尔属性过滤ng-repeat?

[英]How do I filter a ng-repeat by a boolean attribute in Angular.Dart?

每个space都是一个具有名为open的布尔属性的对象,我将它们放入两个列表中。 在这种情况下,我有两个,一个是true ,一个是false 当列表完全呈现时,两个项目都在打开的列表中。 这是我尝试过的:

ng-repeat="space in ctrl.manager.spaces | filter:open"
ng-repeat="space in ctrl.manager.spaces | filter:!open"

ng-repeat="space in ctrl.manager.spaces | filter:open:true"
ng-repeat="space in ctrl.manager.spaces | filter:open:false"

ng-repeat="space in ctrl.manager.spaces | filter:{'open':true}"
ng-repeat="space in ctrl.manager.spaces | filter:{'open':false}"

{{space.open}}确认一个为true ,一个为false

应用此过滤器的正确方法是

ng-repeat="item in items | filter: {open: 'true'}
ng-repeat="item in items | filter: {open: '!true'}

(将'true'放在引号中)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM