1

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:

enter image description here

1 Answer 1

1

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});

Not the answer you're looking for? Browse other questions tagged or ask your own question.