Got stuck on mergemap while learning rxjs. I have 2 observables
let list1= of(1,2)
let list2= of('A','B')
and I want to concatenate the results like this:
1A, 1B, 2A, 2B
How to accomplish the concatenation inside mergemap block
return list1.pipe(
mergeMap((item: any) => {
i want to concatenate items of list1 with items of list2 here
})
).subscribe(console.log)
I appreciate your help with this please
I have tried
return list1.pipe(
mergeMap((item: any) => {
return item + list2
})
).subscribe(console.log)
But it returns 1 [ o b j e c t ] 2 [ o b j e c t ]
Use an inner pipe
Stackblitz: https://stackblitz.com/edit/rxjs-2zsk7b?file=index.ts