如何使用 angularfire2 更新 firebase 对象的子对象

How to update a child of a firebase object using angularfire2

我需要做的就是在单击按钮时将状态值(上图中突出显示的子项)更新为 1,我按照 angluarfire2 文档更新列表值,但没有得到预期的输出。 这是代码

confirm(item: Item){

const items = this.db2.list('/items');
items.update(item.key, { price: 69 }).then(()=>{
  this.toast.show(`${item.name} confirmed two ! `);
  this.navCtrl.setRoot('HomePage');
});

}

也许你可以试试这个:

const items = this.db2.list('/list');
items.update(item.key, { price: 69, status:1 }).then(()=>{
  this.toast.show(`${item.name} confirmed two ! `);
  this.navCtrl.setRoot('HomePage');
});