我有像下面的数组
var people = [
{
name: "a",
status: "approved"
}, {
name: "b",
status: "pending"
}, {
name: "c",
status: "approved"
}, {
name: "d",
status: "pending"
},
];
在ng-repeat中,有没有办法过滤并显示状态为"已批准的对象"?
答案 0 :(得分:0)
从@guru
发表的评论中回答<div ng-repeat="p in people | filter:p.status='approved'">{{p}}</div>
答案 1 :(得分:0)
试试这个:
<label ng-repeat="pep in people">
<label ng-show="pep.status == 'approved'">{{pep.name}}</label>
</label>