1this.announcementCollectionRef = afs.collection<Announcement>('announcements', ref => ref.orderBy('createdAt', 'desc'));
2this.announcements = this.announcementCollectionRef.snapshotChanges().map(actions => {
3 return actions.map(a => {
4 const data = a.payload.doc.data() as AnnouncementId;
5 const id = a.payload.doc.id;
6 return { id, ...data };
7 });
8});
9