Firebase 使用 ${res.user.uid} 而不是 userid 存储数据

Firebase stored data with ${res.user.uid} instead of userid

Firebase 使用 ${res.user.uid} 而不是 userid 存储数据。请告知如何使用 userid

存储用户的解决方案
try{
  const res= await this.afAuth.auth.createUserWithEmailAndPassword(username,password)
  this.afstore.doc('users/${res.user.uid}').set({
    username
  })

  this.user.setUser({
    username,
    uid:res.user.uid
  })

您使用的是 template literals,但您没有使用反提示,而是使用了普通的单引号。

如文档中所述:

Template literals are enclosed by the back-tick character instead of double or single quotes.