Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/443.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';我不明白为什么ng repeat不排序_Javascript_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

Javascript Can';我不明白为什么ng repeat不排序

Javascript Can';我不明白为什么ng repeat不排序,javascript,angularjs,angularjs-ng-repeat,Javascript,Angularjs,Angularjs Ng Repeat,我有以下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">

我有以下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>

无论我做什么,我似乎都不知道如何进行排序——它总是按照数组的顺序出现。有什么帮助吗?

orderBy过滤器仅适用于对象数组,而不适用于对象本身。见文件

{ "5381897" : {
      "newestComment" : 1403280014,
      "title" : "asdf"
    },
  "5595015" : {
      "newestComment" : 1403192555,
      "title" : ""
    },
  "5761260" : {
      "newestComment" : 1403126044,
      "title" : ""
    },
  "5838498" : {
      "newestComment" : 1403279962,
      "title" : "Share Test"
    }
}