我使用angularfire2在firebase数据库中存储数据。我需要将数据添加到存储在数据库中的数组,如下所示:
places:
0:"new Item"
1:"new Item",
2:"new Item"
.
.
.
依此类推我需要的东西。 但就我而言,数据看起来像这样:
这是我的代码:
this.user = this.db.list("/Users/"+ this.currentUserId+'/places');
this.user.push(["new Item"]);
当用户输入新位置时,我需要输入新数据到数组而不是插入新数组。
感谢。
答案 0 :(得分:1)
您正在推送一个数组,尝试推送一个对象。示例:
this.user.push({description: "new Item"});