Type 'String' has no compatible call signatures

家住魔仙堡 提交于 2019-12-25 08:09:10

问题


I'm trying to do a multi-path update using Firebase and AngularFire2. However, I'm getting the error above when I use this:

let fb = firebase.database().ref();
let key = fb.child('/path').push().key();

Any ideas of how I can get the key after pushing something using AngularFire2?


回答1:


As the push method now returns an Observable, the proper way to get the generated $key (using AF2) is doing the following:

let fb = this.af.database.list('/path');
fb.push('item').then(res => console.log(res.key));


来源:https://stackoverflow.com/questions/40453955/type-string-has-no-compatible-call-signatures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!