My Firebase Firestore database is like this:
Collection:orders
DocumentID: (autogenerated)
Document: orderName: string
Variables declared like this:
orderCollection: AngularFirestoreCollection<Order>
orders: Observable<Order[]>
I am getting all 'orders' like this:
orderCollection = this.afs.collection('orders');
orders = this.orderCollection.valueChanges();
I am then printing the orders like this:
<tr *ngFor="let o of orders | async">
<td>{{o.orderName}}</td>
<td><a (click)="editOrder(o.$key)">Edit</a></td>
</tr>
I everything is working perfect up to the edit part.
For edit: how to I send back the document ID of the order? I want to send the order document ID back so I can then edit it. With the realtime database you could do something with $key, but not with the firestore. Suggestions?
orderCollection: AngularFirestoreCollection
orders: Observable
this.orderCollection = this.afs.collection('orders');
this.orders = this.orderCollection.snapshotChanges();
but with the snapshotChanges(), I am getting the error on this.orders:
type 'Observable
Any ideas?