I have a service that retrieves a specific document from Firestore using the getBidremains method.
The method in the TypeScript class is called in ngOnInit like this: this.userInfo = this.firestoreService.getBidremains(userId).valueChanges().subscribe(data => console.log(data));
Although I can see the data being fetched correctly in the console, when trying to access this.userInfo.remainBids, it returns as undefined.
However, in the HTML file (after removing .subscribe), I am able to display the correct value from Firebase using {{ (userInfo | async)?.remainBids}}
I'm struggling with understanding what I am doing wrong here. My goal is to retrieve the document and be able to read the values of the fields within.
The Firestore database document fields are simple, containing email, name, and other properties.
The function in the Firestore service is named getBidremains(userId: string).
This is the TypeScript class where the call is made: this.userInfo = this.firestoreService.getBidremains(userId).valueChanges().subscribe(data => console.log(data));