![](/img/trans.png)
[英]Is it possible reduce the frequency angular.dart re-eval ng-repeat expression?
[英]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.