Skip to content Skip to sidebar Skip to footer

Reverse Order Of Items Pulled From Database In Ng-repeat

I have a 'photos' array in a MongoDB database that is updated as users take photos on Instagram at certain locations. I push information about each new photo to this 'photos' array

Solution 1:

Reverse the array after you get the data.

data.reverse();

HTML:

<element ng-repeat="data" ...

You can also write a filter to do that. There is no built-in filter for reverse AFAIK.

Post a Comment for "Reverse Order Of Items Pulled From Database In Ng-repeat"