N-repeat orderBy date

Ng-repeat orderBy date

我想按日期订购以下商品:

<div class="inbox" ng-repeat="recipient in messages | orderBy: 'recipient':true">
<ul>
<div>
        <li class="inboxItem">
            <a ng-href="#/messaging/userChat/{{recipient.$id}}"><span> {{recipient.$id}} <br> </span></a>
            <div ng-repeat="content in recipient track by $index">
            <span ng-show="$last"> {{content.sender}} {{content.message}} <br> {{content.date}} <br></span>
            </div>
        </li>
</div>
</ul>

我的数据结构是这样的:

--ID:(ng-repeat 中的收件人)
-----日期(ng-repeat中的内容)
--------------发件人
--------------留言
--------------日期
-----日期(ng-repeat中的内容)
--------------发件人
--------------留言
--------------日期

等等

如何按日期值对列表进行排序?为什么我的代码不起作用?

非常感谢!

编辑:

日期采用 Date() 格式 AngularJS。

稍后我可以添加更好的数据描述,现在我可以提供Firebase设置的屏幕截图。

其中1375194092807517是当前用户的USER ID,1384934715162092是发送消息的用户ID。

使用内置过滤器 orderBy,就像您在父级 ng-repeat 中所做的那样。您提供的表达式可以是您范围内的一个函数

其实是我自己想出来的。自从每次发送新消息以来,我将 LastUpdate 设置为 Date() 值,我使用以下 orderBy:

<div class="inbox" ng-repeat="recipient in messages | orderBy: 'LastUpdate':true">

这样我就不需要使用 orderBy 嵌套的 ng-repeat :)

感谢每一位愿意提供帮助的人!