【发布时间】:2017-03-05 16:04:56
【问题描述】:
我正在使用 Ionic 2 和 AngularFire 2 构建应用程序 我想在用户每次点击“投票”按钮时更新一个对象。
用固定数字更新属性是没有问题的
let userRate = 8
this.currentBeer = this.af.database.object('/beers/' + scannedText);
this.currentBeer.update({
votes: 35,
total: 642
})
但我想先获取当前的“votes”和“total”属性,然后再递增这些值
我尝试了几个使用 .subscribe 或 .forEach 方法的选项,但我认为问题出在 observable 的 async 属性上?
非常感谢
【问题讨论】:
标签: firebase ionic2 angularfire2