Flatten a Higher Order Observable with RxJS switch

InstructorAndré Staltz

Share this video with your friends

Send Tweet

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
~ 8 years ago

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

André Staltzinstructor
~ 8 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
~ 8 years ago

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

André Staltzinstructor
~ 8 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".