Reputation: 2075
I have a little probelm using angularfire2 on ionic2, so I have and old firebase backend that is used by an android native app and now I'm rewriting this app using ionic2. So I have a database that saves facebook id like key and value, but I don't know how to do this using angularfire2, when I set the value in push firebase generates an automtic key and put my value. Any help?
My code:
let itemObservable = this.af.database.list('/confirmed/movie/mymovie');
itemObservable.push(this.firebaseAuth.facebook.uid);
My database:
Upvotes: 1
Views: 846
Reputation: 2075
the secret is use update method, so I need to select an object and use an es6 trick:
let myobject = this.af.database.object('/confirmed/movie/mymovie');
let key = this.firebaseAuth.facebook.uid;
myobject.update({[key]: this.firebaseAuth.facebook.uid});
Upvotes: 1