
Reactive Patterns with RxJS for Angular
By :

All higher-order mapping operators map each value from an outer observable to a new inner observable and automatically subscribe and unsubscribe from that inner observable. But not all operators adopt the concat
strategy. There are different strategies, such as merge, switch, and exhaust. Let's break down those strategies!
mergeMap
is the combination of the merge and transformation (or mapping) strategies:
mergeMap = merge(merge) + map (higher-order mapping)
Now that you understand well the concepts of higher-order mapping, let's look at this marble diagram to understand the merging strategy. We will take the example of the merge
operator:
Figure 7.6 – The merge operator – marble diagram
Unlike concat
, merge
will not wait for an observable to complete before subscribing to the next observable. It subscribes to every inner observable at the...