我有以下HTML,我想根据最新评论按时间顺序排序:
<div class="list list-inset"
ng-repeat="(threadId, thread) in messageThreads | orderBy:'thread.newestComment'"
ng-if="thread.newestComment > messageClearTime">
<div class="item item-divider">
{{thread.newestComment}}
</div>
</div>
数据(messageThreads)就是这个,其中threadId作为键,而newestComment作为时间戳:
{ "5381897" : {
"newestComment" : 1403280014,
"title" : "asdf"
},
"5595015" : {
"newestComment" : 1403192555,
"title" : ""
},
"5761260" : {
"newestComment" : 1403126044,
"title" : ""
},
"5838498" : {
"newestComment" : 1403279962,
"title" : "Share Test"
}
}
无论我做什么,我似乎无法弄清楚如何对它进行排序 - 它总是按照数组的顺序出现。任何帮助?