Reputation: 7318
Upvotes: 0
Views: 194
Reputation: 17762
The only method that subscribes to an Observable is subscribe()
.
flatMap (also known as mergeMap), switchMap, map, and so on are operators that transform the original sequence of events. These operators though return an Observable.
RxJs Observables are cold, which means they are activated only when they are subscribed.
RxJs is the javascript implementation of the ReactiveX APIs. If you want to understand in more details how Observables work you can start from the ReactiveX documentation (http://reactivex.io/).
A great course that explains you in details the ReactiveX patterns and the reasons why they are so useful in Angular is the following [https://angular-university.io/course/reactive-angular-architecture-course].2
A third interesting discussion about switchMap, one of the most useful and a bit mysterious operators, can be found here blog.angular-university.io/rxjs-switchmap-operator/
Upvotes: 1