Angularfire 文档参考集
Angularfire Document Referance collection
return this.orderCollection.snapshotChanges().pipe(
map(actions =>
actions.map(a => {
const data = a.payload.doc.data() as Order;
const id = a.payload.doc.id;
return { id, ...data };
})
)
);
}
现在如何在 angularfire2 中获取文档参考数据?
您需要单独加载引用文档。所以像:
customerRef = a.payload.doc.get("customerId");
customerRef.get().then((doc) => {
console.log(doc.data());
})
return this.orderCollection.snapshotChanges().pipe(
map(actions =>
actions.map(a => {
const data = a.payload.doc.data() as Order;
const id = a.payload.doc.id;
return { id, ...data };
})
)
);
}
现在如何在 angularfire2 中获取文档参考数据?
您需要单独加载引用文档。所以像:
customerRef = a.payload.doc.get("customerId");
customerRef.get().then((doc) => {
console.log(doc.data());
})