【发布时间】:2020-07-08 23:16:00
【问题描述】:
我有以下数据库结构
我正在尝试做的是让 menulist 嵌套在 Categories 主列表中。获取 Categories 没有问题,但我尝试获取 menulist 的列表。我有空页。
代码
ngOnInit() {
this.categories = this.af.list("Categories")
this.categories.snapshotChanges()
.pipe(
map(changes =>
changes.map(c => ({ $key: c.payload.key, ...c.payload.val() }))
)
).subscribe((data: any) => {
this.categories = data
console.log(this.categories);
})
}
HTML
<tbody *ngFor="let item of categories.menulist">
<tr role="row" class="even text-right">
<td class="text-right">{{item.body}}</td>
<td class="text-center">{{item.title}}</td>
</tr>
</tbody>
知道如何将menu list 嵌套在Categories 主列表中吗?
【问题讨论】:
标签: angular firebase-realtime-database angularfire2