4

Please see this 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. 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?

1 Answer 1

6

Try this instead:

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

It doesn't order correctly if the dates are from different time zones

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.