Why does Rxjs's pipe wait for the end of ajax to continue like Promise's then?

in Angular , what should I do with Rxjs if one request depends on the result of another?

this.getOne().then(data => {
  // Promise
  return this.getTwo(data);
}).then(data => {
  console.log(data);  // Promise
  return this.getThree(data);
}).then(data => {
  console.log(data); // Promise
})

above is the effect achieved with Promise. How can you achieve a similar purpose with Rxjs"s pipe?


mergeMap :

from(this.getOne)
    .pipe(
        mergeMap(oneData => {
            console.log(oneData)
            return from(this.getTwo)
        }),
        mergeMap(twoData => {
            console.log(twoData)
            return from(this.getThree)
        })
    )
    .subscribe(threeData => {
        console.log(threeData)
        ...
    })
Menu