Reputation:
I'm using angularfire2 to store data in the firebase database. I need to add data to an array stored in the database to be like this:
places:
0:"new Item"
1:"new Item",
2:"new Item"
.
.
.
and so on and that what i need. But in my case the data look like this:
this is my code:
this.user = this.db.list("/Users/"+ this.currentUserId+'/places');
this.user.push(["new Item"]);
When the user enter new place, I need new data enter to the array and not a new array inserted.
Thanks.
Upvotes: 0
Views: 2484
Reputation: 742
You are pushing an array, try to push an object instead. Example:
this.user.push({description: "new Item"});
Upvotes: 1