javascript - AngularJS ngRepeat orderBy not working with DateTime string - Stack Overflow

Please see this JSFiddle <div ng-repeat="booking in testBookings | orderBy: 'booking.sort

Please see this JSFiddle /

<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. Our data currently uses the bookingDateTime for the filter which isn't working. 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.

Any ideas?

Please see this JSFiddle http://jsfiddle/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. Our data currently uses the bookingDateTime for the filter which isn't working. 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.

Any ideas?

Share asked Mar 19, 2014 at 11:07 luke88jonesluke88jones 1331 silver badge5 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Try this instead:

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

working fiddle : http://jsfiddle/Bq7hb/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742292831a4416525.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信