Reputation: 467
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?
Upvotes: 0
Views: 59
Reputation: 598837
I think you're looking for:
getUserInfo.child("addnote").push("Do the dishes");
Upvotes: 3