【发布时间】:2020-01-08 11:18:25
【问题描述】:
我在使用 angular/firestore 和 Firebase 更新文档数据时遇到问题。
我尝试更新的值已在 DOM 中成功更新,但未保存在 Firebase 中,因此它会在页面重新加载时重置为原始值。
我收到此错误:
FirebaseError:函数 DocumentReference.update() 至少需要 2 个参数,但调用时使用了 1 个参数
为我服务:
updateWord(word: Words, newState: string) {
this.firestore.doc("words/" + word.word).update(word.state = newState);
}
在我的 component.ts 中:
changeState(word: Words, state: string) {
this.wordsService.updateWord(word, state);
}
【问题讨论】:
标签: typescript firebase google-cloud-firestore