I have an array variable named users. it contains users id elements.
users=[uid1, uid2, uid3];
and I want to map this array and get users info from Firestore like this:
let userInfo;
userInfo = users.map((element:any) => {
if (element){
this.afsService.doc(`user/${element}`).subscribe(user => {
return {...user}
});
}
...
when this code worked, I got this error:
You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
so my question; how to execute Observable in array iterate?