【发布时间】:2015-12-18 09:38:08
【问题描述】:
我有以下设置
$scope.array =
[
{propertyA: "test",
propertyB: {
propertyC: [true, true, false]
}
},
{propertyA: "test2"},
{propertyA: "test3"}
]
然后
<div ng-repeat="item in array| filter :{propertyB: ''} :true">
{{item.propertyA}}
</div>
所以问题是:
此设置不显示任何内容
如果我更改为
|filter :{propertyB: '!!'} :true,它不会显示任何内容如果我更改为
|filter :{propertyB: undefined} :true,它会显示所有内容
我想不通。
目标:我想显示未定义 propertyB 的项目,在其他情况下则相反。
编辑 1:如果我使用 angular.equals(item.propertyB, undefined) 遍历数组,我会得到 false, true, true
编辑 2:jsfiddle UPDATED
编辑3:我已经更新了问题
【问题讨论】:
-
请添加 jsfiddle 或 plunkr
-
这里已经回答了这个问题:stackoverflow.com/questions/25177004/…
-
只需删除 true ,一切正常!和!!。
-
我已经更新了问题
标签: javascript angularjs angularjs-filter