每个space
都是一个具有名为open
的 bool 属性的对象,我将它们放入两个列表中。在本例中,我有两个,一个是 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'
放在引号中)
关于dart - 如何在 Angular.Dart 中通过 bool 属性过滤 ng-repeat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26670206/