问题
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