【发布时间】:2020-07-03 09:26:59
【问题描述】:
我正在订阅 Firestore 的文档“this.afs.collection('messaging').doc(email);”它位于 NgOnInit() 中。在 Firestore 中创建另一个文档后,我想刷新数据。我对做到这一点的最佳方法有点困惑。我已经尝试过“window.location.reload()”,但我的 POST 操作没有完成。我也尝试过使用 changeDetector 也没有帮助。
组件
ngOnInit(){
const doc = this.afs.collection('messaging').doc(email);
doc.subscribe( usersData => { this.users = usersData });
`
`
模板
<ng-container *ngFor="let user of users;index as i">
{{user.payload.doc.data().displayName}}
</ng-container>
`
【问题讨论】:
标签: angular firebase google-cloud-firestore rxjs ionic4