-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Hi,
This one must be really simple as everyone who uses Firebase must encounter this problem.
In my server I save items like this:
var db = firebase.database();
var ref = db.ref("users");
var userRef = ref.child("userA");
var newUserRef = userRef.push();
newUserRef.set({
Date : Date.now(),
Msg : 'test'
});
Now assuming I have 2 items in 'userA' I want to display the items in descending order so the last item that got 'pushed' will be the first to be displayed to the user.
I'm using:
this.itemsFirebase = this.af.database.list('/users/userA');
And in the template:
<li *ngFor="let itemFirebase of firebaseService.itemsFirebase | async">
<notification-item [item]="itemFirebase"></notification-item>
</li>
How can I reverse the order so that the user will see the last item that was pushed as the first item in the ngFor?
I read about Querying List(https://github.com/angular/angularfire2/blob/master/docs/4-querying-lists.md) but I couldn't find what I was looking for.
Thanks!