我有这样的对象,左
{
Nov 17, 2016:Array[1]
Dec 1, 2016:Array[1]
Nov 22, 2016:Array[1]
Nov 23, 2016:Array[1]
Nov 21, 2016:Array[1]
}
我希望以相同的日期格式将其排序为降序 输出应该是......提前感谢。
{
Dec 1, 2016:Array[1]
Nov 23, 2016:Array[1]
Nov 22, 2016:Array[1]
Nov 21, 2016:Array[1]
Nov 17, 2016:Array[1]
}
https://plnkr.co/edit/kZzxHDg1om7ylbGYeloe?p=preview plunker
答案 0 :(得分:1)
你只需要把
ng-repeat =“data.messages中的消息| orderBy:'createdTime':true”
它将按 createdTime
的降序排序您的数据<div class="panel panel-default" ng-repeat="message in data.messages | orderBy:'createdTime':true">
<div class="panel-heading" style="color:blue">{{ message.createdTime | date:'MMM d, yyyy' }}</div>
<div class="panel-body" >
<span uib-tooltip="{{message.userName}}" tooltip-placement="top">{{ message.groupList[0].userName }}, {{ message.groupList[1].userName }}</span>
</div>
</div>
检查