【发布时间】:2018-05-24 00:25:04
【问题描述】:
我想获取频道的密钥并将此密钥添加到路径中。这是我的代码:
firebase.database().ref('channels/').orderByKey().limitToLast(1).once('value').then(function (snapshot) {
const channel = Object.keys(snapshot.val())[0];
createUserChannel(channel, currentUser, db);
....
function createUserChannel(channel, currentUser, db) {
db.list('channelUsers/' + channel).push(currentUser);
}
但我有这个错误:
ERROR Error: Uncaught (in promise): Error: Reference.push failed:
first argument contains a function in property 'channelUsers.-
LDCclTrWKekW0MqUy-n.g.Bg.Cg' with contents = function XMLHttpRequest() {
[native code] }
我的频道密钥中没有“g.Bg.Cg”。这是什么?
【问题讨论】:
-
很难说到底发生了什么,因为我们看不到
channel、db,和currentUser的值。您能否使用每个硬编码值重现问题,然后更新您的问题以显示这些值?
标签: javascript angular firebase firebase-realtime-database