The part it doesn\'t like is the get() method in ngOnInit(). Is says, \"[ts] Property \'get\' does not exist on type \'AngularFirestoreDocument<{}>\'.\"
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
Actually,
AngularFirestoreDocument<{}>
doesn't haveget
property, useAngularFirestoreDocument<{}>.ref
instead:
this.afs.collection("users")
.doc(this.id)
.ref
.get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
} else {
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});