0

In Firebase I have the function addSubmit which is meant to submit data Do the dishes to an array named addnote. However, I do not know how to get the push method to send to an array. My code is below.

addSubmit(){
    var self = this;
    var user = firebase.auth().currentUser;
    var getUserInfo = firebase.database().ref('users/' + user.uid);

        if (user){
            getUserInfo.push({
                addnote: ["Do the dishes"]
            });
        }
}   

My push method winds up giving me several addnote arrays instead of placing all strings of Do the dishes in the same one. So it looks like:

addnote - 'Do the dishes'
addnote - 'Do the dishes'

As opposed to:

addnote - 'Do the dishes', 'Do the dishes'

How would I reorganize my code to make this work?

1 Answer 1

3

I think you're looking for:

getUserInfo.child("addnote").push("Do the dishes");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.