Angularfire2 向数据库添加一个新用户

Angularfire2 add a new user to the database

我使用了以下登录方式:

login() {
  this.auth.login();
this.authService.login().subscribe(() => {
  if (this.authService.isLoggedIn) {
      console.log("ADDING THE USER..");
      // Add a new user to the users table
      this.af.child("users").child(this.authService.userData.uid).set({
          provider: this.authService.userData.provider,
            name: this.getName(this.authService.userData)
      });
    // Redirect the user
    this.router.navigate(['/panel']);
  }
});

}

与文档中的方法几乎相同:https://www.firebase.com/docs/web/guide/user-auth.html#section-storing

当我 运行 我的应用程序时,出现以下错误:

Property 'child' does not exist on type 'AngularFire'.

并且未添加用户。怎么了?

我只需要向我的 Firebase 数据库添加一个新对象。 以下工作,但我需要如上所示的结构:

this.users = this.af.database.list('/users');
this.users.push("TEST");

那么,如何使用 https://www.firebase.com/docs/web/guide/user-auth.html#section-storing 中的相同结构将新用户对象添加到我的数据库中?为什么我不能 运行 我的代码,如果它与记录的一样?

更新

我的新密码:

this.af.database.object('/users/${this.authService.userData.uid}').set({
              provider: this.authService.userData.provider,
                name: this.getName(this.authService.userData)
          });

使用object(); child() 不存在:

this.af.database.object(`users/${this.authService.userData.uid}`).set({...})

这是一个较短的版本。

import { AngularFireDatabase } from "angularfire2";

...

constructor(private afd: AngularFireDatabase) {}

...

this.afd.object(`users/${this.authService.userData.uid}`).set({...});