I read every question about it, and I still have not found the answer to this question. Therefore, do not mark this as a duplicate.
I am using AngularFire with Angular 2 and Typescript. I use FirebaseListObservableto pull a list of the last 24 entries from the endpoint. Here is my code:
import { Component } from '@angular/core';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
@Component({
selector: 'story-list',
templateUrl: './story-list.component.html',
styleUrls: ['./story-list.component.scss']
})
export class StoryListComponent {
stories: FirebaseListObservable<any[]>;
constructor(af: AngularFire) {
this.stories = af.database.list('/stories', {
query: {
limitToLast: 24
}
});
}
}
This returns a list of the last 24 stories, as expected, but when I do them on the page with
<p *ngFor="let story of stories | async">{{ story.title }}</p>
It shows the oldest story at the top, and the latest at the bottom. I understand why this is so, and I do not claim that this is a problem, but how would I change this? I would like to be able to undo this in the request, but if it is not possible, I would be open to somehow change it to rendering.
Whatever your answer, please do not just link to the documentation. There is no documentation for AngularFire that fully explains this. I read every word. Please provide real working code.
However, one decision that I absolutely do not accept is to keep a negative date in the records during creation and then sort them based on this. This is the worst solution I've ever heard, and a real database system will allow you to do this in a query. Therefore, please do not even offer this.If you have any ideas, I would really appreciate it. I would really like to use another product because I love Firebase.