Can you clarify why the operators tap
and map
of inner observable are not being called? Shouldn't combineLatest
subscribe to the observables it receives in obsArr
? Why are these operators not triggered by this subscription?
const obsArr = [];
[[1, 2], [3, 4], [5, 6]].map(arr => {
const observable = from(arr);
observable.pipe(
tap(item => {
// this is NOT called
console.log('tap', item)
}),
map(item => {
// this is NOT called
return item * -1;
})
);
obsArr.push(observable);
});
combineLatest(obsArr).subscribe(latestValues => {
console.log(latestValues);
// LOG: [2, 4, 5]
// LOG: [2, 4, 6]
});
View the working stackblitz here:
Your insights on this matter are greatly appreciated!