【发布时间】:2019-10-12 00:50:59
【问题描述】:
我有一个 ionic v4 应用程序。当用户点击链接(routerLink="/profile")导航到配置文件页面时,我对 firestore 进行查询,一切都很好,查询是:
let ref = this.asf.collection('posts', ref => ref
.where('creatorId', '==', creatorId)
.where("type","==","N")
.orderBy("createAt", "desc")
.limit(count)
).snapshotChanges();
console.log("-----------------");
console.log(ref);
console.log(ref.map);
console.log("-----------------");
ref.map(actions => {
return actions.map(a => {
const data = a.payload.doc.data();
const id = a.payload.doc.id;
return { id, ...data };
});
});
但是,当用户通过在浏览器中输入 url 进入时,ref.map 是未定义的。
为什么当用户在浏览器中输入 url 进入时 ref.map 返回 undefined?有什么想法或建议吗?
【问题讨论】:
标签: angular firebase google-cloud-firestore ionic4 angularfire2