【发布时间】:2019-06-16 13:50:49
【问题描述】:
我目前正在使用 Ionic 4 和 Firestore。我正在尝试检查 Firestore 中是否存在文档 ID,然后根据情况执行 if-else。
但是,当我返回值并尝试将其分配给变量时,它不保存该值。这是我的示例代码
this.service.checkLogin(this.test).then((data) => {
this.testVar = data;
console.log(this.testVar) //here shows 'false if data is false'
if (testVar = true) {
console.log(this.testVar) //however, over here it will show true
even if the result above was initally false.
this.router.navigateByUrl('/home');
}
else {
};
})
【问题讨论】:
标签: javascript ionic-framework google-cloud-firestore