This commit is contained in:
Phan Huy Tran 2024-11-20 12:48:42 +01:00
parent ac266e77ce
commit ae74e61e20

View File

@ -1,6 +1,6 @@
import {Injectable} from '@angular/core';
import {Show} from '../model/show';
import {collection, collectionData, Firestore} from '@angular/fire/firestore';
import {collection, collectionData, Firestore, orderBy, query} from '@angular/fire/firestore';
import {Observable} from 'rxjs';
@Injectable({
@ -12,7 +12,8 @@ export class ShowService {
constructor(private firestore: Firestore) {
const showsRef = collection(this.firestore, this.seriesCollection);
this.shows$ = collectionData(showsRef, {idField: 'uid'}) as Observable<Show[]>;
const showsQuery = query(showsRef, orderBy('id'));
this.shows$ = collectionData(showsQuery, {idField: 'uid'}) as Observable<Show[]>;
}
getShows() {