0
我试图用下面的代码更新数据库上的'现金'值。Ionic 3更新Firebae上的数据库
updateCash() {
const userId = this.authCtrl.showUser().uid;
this.afDatabase.database.ref(`users/${userId}/userInfos`).transaction(eventSnapshot => {
eventSnapshot.cash += 100;
this.afDatabase.list(`users/${userId}/userInfos`).push(eventSnapshot.cash);
});
}
但是出现了一些问题,并保存这样的结果。
我该如何解决呢?谢谢。
如何更新现金=现金+200没有现金:200? – onurkaya