Is It Possible To Reverse A Firebase List?
I've read every question on SO about this and I still haven't found an answer to this. So don't mark this as a duplicate. I'm using AngularFire with Angular 2 and Typescript. I'm u
Solution 1:
As far as I'm aware, the Firebase queries are always in ascending order.
However, you can reverse the ordering of the rendered list using the map
operator to reverse the array that's emitted by the AngularFire2
observable:
import "rxjs/add/operator/map";
...
this.stories = af.database.list('/stories', {
query: {
limitToLast: 24
}
}).map((array) => array.reverse()) as FirebaseListObservable<any[]>;
If you'd prefer to do it in the template, you could have a look at this answer.
Post a Comment for "Is It Possible To Reverse A Firebase List?"