Angularfire文档参考收集

时间:2019-11-22 02:09:12

标签: javascript angular firebase google-cloud-firestore angularfire2

    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 };
        })
      )
    );
  }

enter image description here

现在如何在angularfire2中获取文档参考数据?

1 个答案:

答案 0 :(得分:0)

您将需要单独加载参考文档。像这样:

customerRef = a.payload.doc.get("customerId");
customerRef.get().then((doc) => {
  console.log(doc.data());
})