AngFire在createuser()中添加字段

时间:2017-03-21 11:30:14

标签: angular ionic2 angularfire2

有没有办法在创建用户时添加字段displayName? 例如,我正在研究这个问题:

Signup(email: string, password: string, displayName: string) {
    this.angFire.auth.createUser({
      email: email,
      password: password,
      displayName: displayName
    }).catch(
      (err) => {
        console.log(er.....

但我在displayName上有错误:

Argument of type '{ email: string; password: string; displayName: string; }' is not assignable to parameter of type 'EmailPasswordCredentials'. Object literal may only specify known properties, and 'displayName' does not exist in type 'EmailPasswordCredentials'.

我在离子2中使用了Firebase,angular2。如果我只放了电子邮件和密码就行了。

更新

这可行吗?内部注册功能,创建用户后,写下这个?

 firebase.auth().onAuthStateChanged((user) => {
      if (user) {
        let user1 = firebase.auth().currentUser;
        if (user != null) {
          user1.displayName = displayName;
        }
      } else {
        console.log('no user');
      }
    });

更新

它只能处于阅读模式

0 个答案:

没有答案