【问题标题】:Firebase stored data with ${res.user.uid} instead of useridFirebase 使用 ${res.user.uid} 而不是 userid 存储数据
【发布时间】:2019-08-07 03:23:33
【问题描述】:

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
  })

【问题讨论】:

    标签: javascript firebase firebase-authentication google-cloud-firestore angularfire2


    【解决方案1】:

    您使用的是template literals,但您使用普通单引号而不是使用后提示。

    如文档中所述:

    模板文字由反引号字符括起来 而不是双引号或单引号。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-21
      • 2020-07-26
      • 2011-12-12
      • 2015-12-04
      • 1970-01-01
      • 2019-02-18
      • 2021-12-26
      相关资源
      最近更新 更多