Reputation: 485
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?
Upvotes: 0
Views: 2863
Reputation: 485
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));
Upvotes: 1