angular - firestore 文档中的未定义字段
问题描述
我试过这样:
export class EditDoctorComponent implements OnInit {
doctorName :any;
...
ngOnInit(): void {
const doctorID = this.act.snapshot.paramMap.get('id');
this.db.collection("doctors").doc(doctorID)
.valueChanges()
.subscribe( (res :any) => {
this.doctorName = res.doctorName;
console.log('Name = ' + this.doctorName);
})
}
在控制台中,我收到结果未定义。我感谢任何帮助或指导。谢谢!
解决方案
推荐阅读
- android - 一个应用程序需要 2 个图标
- kubernetes - 没有副本的redis集群
- python-3.x - dask_dataframe.compute() 是否需要执行
- django - 如何在 Python 中从父模型访问子模型
- ios - 实例成员作为默认参数
- javascript - 如何使用 jQuery 或 JavaScript 实现相同的 position:sticky 功能?
- amazon-web-services - AWS EKS - 节点组更新实例类型
- html - 使 on-hover ::before 元素在初始点击期间不出现
- amazon-web-services - ec2 的 PolicySimulator:AttachVolume
- python-3.x - 根据其ID更改按钮文本?