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