I try to find a way to get this scenario working :
- I have an observable
talks$which emits a list of all talks. - A talk have a property
personId - This property can be mapped to the person using an Observable.
- I try to map it into a class
TalkWithPerson
const test = this.talks$.pipe(
exhaustMap(talks =>
talks.map(t => this.getPersonById(t.personId).pipe(map(p => newTalkWithPerson(t, p))))
),
);
Currently, this emits 2 observable, each one emitting my TalkWithPerson object. (Observable<Observable<TalkWithPerson>>)
I would like to have an Observable<TalkWithPerson[]> if possible.
I was thinking going the hard way with getting all the people and all the talks and use combineLatest with a project function to match the records but I don't want to load all the persons, it will cause to load a huge list...
Thank you for your help !
StackBlitz : https://stackblitz.com/edit/talks-person