【发布时间】:2019-02-26 16:01:24
【问题描述】:
我有一个基本的 Firestore 集合查询。我已将每个返回的项目添加到对象数组中。我真正想做的是在 HTML 中循环这些内容并显示键和值。
firestore_albums = [];
...
getData() {
this.db.collection(`users/myid/albums`).get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
const data = doc.data();
this.firestore_albums.push({ ...data });
});
})
HTML
<div *ngFor="let item of firestore_albums | keyvalue">
{{item.key}}:{{item.value}}
</div>
不幸的是,这只是返回:
0:[对象对象]
1:[对象对象]
【问题讨论】:
标签: angular loops object google-cloud-firestore