我有这样的api回复: -
"leads": [{
"_id": "qasim@obg.ae",
"actions": {
"email": {
"count": 75
},
"chat": {
"count": 57
},
"email": {
"count": 11
}
},
"data": {
"agent": {
"name": "Muhammad Qasim"
}
}
}, {
"_id": "dana@obg.ae",
"actions": {
"chat": {
"count": 37
},
"email": {
"count": 11
},
"call": {
"count": 3
},
"manual": {
"count": 3
}
},
"data": {
"agent": {
"name": "Dana Elshibekova"
}
}
}, {
"_id": "tatiana@obg.ae",
"actions": {
"chat": {
"count": 21
},
"manual": {
"count": 5
},
"call": {
"count": 3
},
"email": {
"count": 3
}
},
"data": {
"agent": {
"name": "Tatiana Shigaeva"
}
}
}
}]
HTML:
<ul>
<li ng-repeat="agent in leads | limitTo: 10">
<a href="agent/{{agent._id}}">
<div class="col s5">{{agent.data.agent.name}}</div>
<div class="col s2">{{agent.actions.call.count}} <span ng-if="!agent.actions.call.count">0 </span>Calls</div>
<div class="col s2">{{agent.actions.email.count}} <span ng-if="!agent.actions.email.count">0 </span>Emails</div>
<div class="col s2">{{agent.actions.chat.count}} <span ng-if="!agent.actions.chat.count">0 </span>Chats</div>
</a>
</li>
</ul>
我有两个带有点击功能的按钮,我想对最高的email.count和最低的email.count进行排序
注意:我在email.count和chat.count以及call.count中有计数/值。
如何在angularjs中对此类数据进行排序,其中json键重复为call,email和chats的计数。
我正在使用AngularJS v1.6.1