如何按子属性订购项目列表"active" : true
?第一个节点是为每个朋友动态插入的 id。
<li data-ng-repeat="friend in friends|orderBy:'friend.active':true">
<span class="name">{{friend.name}}</span>
<span class="phone">{{friend.lastName}}</span>
</li>
$scope.friends = {
"12345": {
"name": "Dhiraj",
"lastName": "Agarwal",
"active" : false
},
"23456": {
"name": "Poonam",
"lastName": "Mittal",
"active" : false
},
"34567": {
"name": "Suresh",
"lastName": "Bansal",
"active" : true
},
"45678": {
"name": "Usha",
"lastName": "Goel",
"active" : false
}
};