Flatten a Higher Order Observable with RxJS switch

André Staltz
InstructorAndré Staltz
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 years ago

To consume the higher order RxJS Observable, we had to do a subscribe inside a subscribe. In this lesson, we will learn a better approach using flattening operators, of which switch() is a common and simple one.

Rene
Rene
~ 7 years ago

Is there any way you can include examples with real data?

André Staltz
André Staltzinstructor
~ 7 years ago

Hi Rene. Yes, keep on watching the course and in the 5th lesson from now, there is a real-world example for HTTP requests with switch().

Scott C
Scott C
~ 7 years ago

Why is it called switch? It looks like it just flattens.

André Staltz
André Staltzinstructor
~ 7 years ago

Hi Scott. It performs flattening, and it's called switch because it is one of the flattening strategies, to "switch from the previous inner Observable to the next inner one".

Markdown supported.
Become a member to join the discussionEnroll Today