Whats the way to simplify something like the following code example? I can't find the right operator.. could anyone give a short example?
this.returnsObservable1(...)
.subscribe(
success => {
this.returnsObservable2(...)
.subscribe(
success => {
this.returnsObservable3(...)
.subscribe(
success => {
...
},
As mentioned in comments, you are looking for the flatMap
operator.
You can find more details in previous answers :
Your example would read as :
this.returnsObservable1(...)
.flatMap(success => this.returnsObservable2(...))
.flatMap(success => this.returnsObservable3(...))
.subscribe(success => {(...)});