【发布时间】:2019-04-04 10:02:48
【问题描述】:
我有文档 id 并尝试通过 id 获取文档数据:
export class MyComponent implements OnInit {
customerDoc: AngularFirestoreDocument<Customer>;
customer: Observable<Customer>;
constructor(private afs: AngularFirestore) {
const id = this.route.snapshot.paramMap.get('id');
this.customerDoc = afs.collection<Customer>('customers/'+id);
this.customer = this.customerDoc.snapshotChanges();
}
}
但它什么也没返回。
【问题讨论】:
-
您检查过您的
id是否为空吗? -
是的,身份证是正确的
标签: angular firebase google-cloud-firestore angular6