Theoretically, I know what mergeMap is and how it works, but when I try to understand using practical approach I get confused, this is what I have done so far
const input1$= of("value 1","value 2","value 3");
const input2$= of(1,2,3,4);
const obs=input1$.pipe(
mergeMap(data1=>{
return input2$
.pipe(map(ch=>{ch+' '+data1}))})
)
unfortunately, I am getting undefined when I try to merge them, your help would be appreciated to make me understand how it works.
You are not returning anything in your second pipe
Try this
const obs=input1$.pipe( mergeMap(data1=>{ return input2$.pipe(map(ch=>{ return ch+' '+data1 }))}) )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.