【发布时间】:2020-08-08 01:00:46
【问题描述】:
// round page
newRound() {
console.log('new round ', this.round);
this.you.score = +this.score;
this.round++;
console.log('THE PLAYERS -> ', this.players);
this.afStore.collection('matches').doc(this.gameRoom).collection('match').doc(`${this.round}`).set({players: this.players, round: this.round}).then(() => {
console.log('UPDATED GAME');
});
this.router.navigate(['/events/tab2/' + this.gameRoom]);
}
// Tab page that goes to the round page
// NOTE: this is for the next page, round 1,2,3,4 etc...
theRound() {
this.newRound++;
console.log('this is the new round ', this.newRound);
this.afStore.collection('matches').doc(this.gameRoom).collection('match').doc(`${this.newRound}`).set({players: this.players, round: this.newRound});
this.afStore.collection('matches').doc(this.gameRoom).collection('match').doc(`${this.newRound}`).valueChanges().subscribe((v: any) => {
this.router.navigate(['/events/tab2/' + this.gameRoom + '/' + v.round]);
console.log('data returned from firebase ', v);
});
}
大家好!我有问题。我正在尝试更新firebase中的特定集合,但它会创建集合,但一旦我在圆形页面中按下一个值,它就不会更新“分数”。它还使用更新的分数创建第二个集合。任何帮助将不胜感激。
【问题讨论】:
-
你在哪里更新分数
-
我正在通过离子输入更新它,其中 NgModel 是得分( this.score )。
标签: javascript typescript firebase ionic4