-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
DocumentChangeAction dosen't appear to be exported as a public API, along with all the interfaces under interfaces.ts, not sure about the other interfaces but DocumentChangeAction is exposed by .snapshotChanges(), therefore it should also be exported.
Use Case
Transforming the data into data with it's id in a function to avoid code duplication
function addIdsToItems(items: DocumentChangeAction[]) {
return items.map(a => {
const data = a.payload.doc.data() as Pizza;
const id = a.payload.doc.id;
return { id, ...data };
});
}
//use
this.itemsRef.snapshotChanges().map(addIdsToItems);
Speaking of which, it would be nice if AngularFire provided this or a similar function since it's super boiler plately and i'm sure everyone needs to use it
Metadata
Metadata
Assignees
Labels
No labels