更新时间:2023-02-14 09:24:30
在AngularFirestore中,它只是document.id
.但是,要使其正常工作,必须使用snapshotChanges
而不是valueChanges
.所以:
In AngularFirestore it is simply document.id
. But for this to work you must use snapshotChanges
instead of valueChanges
. So:
orders = this.orderCollection.snapshotChanges();
然后:
<tr *ngFor="let o of orders | async">
<td>{{o.data().orderName}}</td>
<td><a (click)="editOrder(o.id)">Edit</a></td>
</tr>
灵感来自: Firestore从集合中获取文档ID 和获取包含文档ID的集合.