I have a service which fetches a particular document from firestore using this method
getBidremains(userId: string){ return this.firestore.collection('userProfile').doc(userId);
In the typscript class I am calling this method in ngOnInit as this.userInfo = this.firestoreService.getBidremains(userid).valueChanges().subscribe(data => console.log(data));
In the console I can see the data is fetched correctly, but when i try to use this.userInfo.remainBids it prints nothing. In the console it shows as undefined.
But in the html file( after removing .subscribe) i am able to print the correct value from firebase using {{ (userInfo | async)?.remainBids}} Can someone please help me out here, not sure what is it that I am doing wrong. I want to fetch the document and be able to read values of the field contained in the document.
firestore database document fields are simple it contains email, name and other fields
This is firestore service function name is 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));