当我要保存---
title: "Simple Example"
output:
xaringan::moon_reader
---
```{r setup,include=FALSE}
knitr::opts_chunk$set(echo = FALSE,message = FALSE,warning = FALSE)
```
## Flow chart
```{r example,fig.align='center',fig.retina=3}
suppresspackageStartupMessages(library(widgetframe))
l=DiagrammeR::mermaid("
graph LR;
A((Orange)) --> B((Grey));
classDef orange fill:#f96;
classDef grey fill:#d3d3d3;
class A orange;
class B grey;
")
widgetframe::frameWidget(l)
```
类中的var
时遇到问题,我可以在控制台中打印,但是当我要存储它时,就会遇到问题。
我尝试解析为String,添加AuthService.ts
或仅添加(+ " ")
,但是我不能。
这是我的.toString()
:
auth.service.ts
控制台会打印出我期望的内容,但是在我的浏览器中,在“检查”模块中出现下一个错误:
获取文档时出错:TypeError:无法读取未定义的属性“ doc”
我不知道我的 export class AuthService {
isLoggedIn = false;
username: string;
constructor(private authService:AngularFireAuth,private db : AngularFirestore) { }
login(email:string,password:string){
return new Promise((resolve,rejected) =>{
this.authService.auth.signInWithEmailAndPassword(email,password).then(user => {
this.isLoggedIn = true;
resolve(user);
const uid = user.user.uid;
this.db.collection("users")
.doc(uid)
.ref
.get().then(function(doc) {
if (doc.exists) {
console.log("Nombre: " + doc.data().name);
this.username = JSON.stringify( this.doc.data().name);
}
}).catch(function(error) {
console.log("Error getting document:",error);
});
}).catch(err => rejected(err));
});
}
}
}
是保存还是显示不好,但我认为这是我想要的但无法存储的奇怪打印,请您帮我一下, d非常感谢!