2

I am using ionic 2.

I need update data into firebase using Firebase 3

Here is my code.

import firebase from 'firebase'; up() { var v=this.Editflat.value; firebase.database().ref('/flats').update(this.key,v).then(res=> {console.log("UPDATED",res)}); } 

I am getting this error

Error: Firebase.update failed: First argument must be an object containing the children to replace. 

How can I fix this issue?

Kindly advice me,

Thanks.

1 Answer 1

1

I presume this is what you want:

var v = this.Editflat.value; firebase.database().ref('/flats/' + this.key).update(v).then(res => { console.log("UPDATED",res) }); 

The variable v should be an Object. You can read more about it here.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for ur reply.After I update to Firebase page redirection without push why?
I don't understand your question. Do you mean the page redirects without updating the Firebase data? You must post more code and edit your question details.
I called function using this button <button ion-button full type='submit' (click)="up()">Update</button>.Update data into firebase successfully.But page redirect to rootpage.Why?.I hide the update code.does not page redirection.But I dont write any page redirect code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.