[英]How do I filter a ng-repeat by a boolean attribute in Angular.Dart?
Each space
is an object with a boolean attribute called open
, and I'm putting them into two lists. 每个space
都是一个具有名为open
的布尔属性的对象,我将它们放入两个列表中。 In this case, I have two of them, one is true
and one is false
. 在这种情况下,我有两个,一个是true
,一个是false
。 When the list renders at all, both items are in the open list. 当列表完全呈现时,两个项目都在打开的列表中。 Here's what I've tried: 这是我尝试过的:
ng-repeat="space in ctrl.manager.spaces | filter:open"
ng-repeat="space in ctrl.manager.spaces | filter:!open"
and 和
ng-repeat="space in ctrl.manager.spaces | filter:open:true"
ng-repeat="space in ctrl.manager.spaces | filter:open:false"
and 和
ng-repeat="space in ctrl.manager.spaces | filter:{'open':true}"
ng-repeat="space in ctrl.manager.spaces | filter:{'open':false}"
{{space.open}}
confirms that one is true
and one is false
. {{space.open}}
确认一个为true
,一个为false
。
The correct way to apply this filter is 应用此过滤器的正确方法是
ng-repeat="item in items | filter: {open: 'true'}
ng-repeat="item in items | filter: {open: '!true'}
(put the 'true'
in quotes) (将'true'
放在引号中)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.