【发布时间】:2020-01-07 00:03:23
【问题描述】:
我尝试刷新数据库中变量的值。但是函数.set() 需要两个参数,我不明白第一个是什么。
我尝试使用.push() 函数,但这会在我的数据库中创建一个新行。我不想要那个。我想要改变价值。
所以我知道我需要使用.set() 函数,但她需要两个参数项:Firebase 操作和数据
第一个是什么?
this.afAuth.authState.subscribe(data => { // ajoute des tacoPoint
this.test = this.afDatabase.list(`TacoPoint/${data.uid}`).valueChanges();
this.test.forEach(data => { // ajoute des tacoPoint
data.forEach(e => {
e.Tacopoint = e.Tacopoint + 20;
console.log(e);
})
})
})
this.afAuth.authState.subscribe(auth => {
this.afDatabase.list(`TacoPoint/${auth.uid}`).set(); // need to set the new TacoPoint in the data base
})
【问题讨论】:
-
你使用的是firebase还是firestore?
-
我使用firebase(实时数据库)
标签: angular firebase-realtime-database angularfire2