AngularJS的ngRepeat order不能使用DateTime字符串

AngularJS ngRepeat orderBy not working with DateTime string

本文关键字:DateTime 字符串 不能 ngRepeat order AngularJS      更新时间:2023-09-26

请查看此JSFiddle http://jsfiddle.net/luke88jones/MfLqa/2/

<div ng-repeat="booking in testBookings | orderBy: 'booking.sortDate'">
      <span>{{booking.bookingDateTime | date:'dd-MMM-yy HH:mm'}}</span>      
</div>

我正在尝试使用排序来排序一个ng-repeat。我们的数据目前使用bookingDateTime作为过滤器,但它不起作用。我不确定如果角没有解决这个功能,所以把sortDate属性作为一个ISO字符串,并试图使用这个排序,但它似乎仍然没有工作。

任何想法?

试试这个:

<div ng-repeat="booking in testBookings | orderBy:'sortDate'">

working fiddle: http://jsfiddle.net/Bq7hb/