【发布时间】:2018-02-07 19:27:53
【问题描述】:
我这里有这个代码块;
return this.db.list(`users/${currentId}/chatThreads/`)
.map((thread) => {
thread.map((t) => {
let x = {
key: t, // <- Undefined? Where's the key
count: t.$value,
}
console.log(x);
return x;
})
});
尝试将此对象转换为上面的简单键值 JSON(使用x)。但是,我可以让计数与值 1 一起使用,但键未定义。
我在这里错过了什么?
【问题讨论】:
-
不是
this.db.list(users/${currentId}/chatThreads/).valueChanges().map()吗? -
这是 angularfire.. 我不认为 valueChanges() 存在..(顺便说一句,这不是实时数据库)
标签: firebase firebase-realtime-database angularfire angularfire2