简体   繁体   English

AngularJS ngRepeat orderBy不使用DateTime字符串

[英]AngularJS ngRepeat orderBy not working with DateTime string

Please see this JSFiddle http://jsfiddle.net/luke88jones/MfLqa/2/ 请看这个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>

I am trying to use the orderBy to sort a ng-repeat. 我正在尝试使用orderBy对ng-repeat进行排序。 Our data currently uses the bookingDateTime for the filter which isn't working. 我们的数据目前使用bookingDateTime作为无效的过滤器。 I wasn't sure if angular wasn't resolving the function so have put in the sortDate property as an ISO string and tried to sort using this but still it doesn't seem to be working. 我不确定角度是否没有解析函数,所以将sortDate属性作为ISO字符串放入并尝试使用此排序,但它似乎仍然无法正常工作。

Any ideas? 有任何想法吗?

Try this instead: 试试这个:

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

working fiddle : http://jsfiddle.net/Bq7hb/ 工作小提琴: http//jsfiddle.net/Bq7hb/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM