brians69
brians69

Reputation: 485

Type 'String' has no compatible call signatures

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

Answers (1)

brians69
brians69

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

Related Questions