Firebase Firestore get() not working

后端 未结 2 2211
忘了有多久
忘了有多久 2021-02-20 15:40

The part it doesn\'t like is the get() method in ngOnInit(). Is says, \"[ts] Property \'get\' does not exist on type \'AngularFirestoreDocument<{}>\'.\"

2条回答
  •  醉酒成梦
    2021-02-20 16:31

    You're using Angular Fire, so the syntax is the following:

    this.afs.collection("users").doc(this.id).valueChanges(user => {
         console.log(user);
    });
    

    Read the documentation here: https://github.com/angular/angularfire2

提交回复
热议问题