Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rxjs pipes - multiple operators in one pipe or multiple pipes?

I like the readability provided by

observable
  .pipe(operator1)
  .pipe(operator2)
  .pipe(operator3)
  .subscribe()

And it reminds me of a chain of thens for a promise.

But I know this is in every documentation example

observable
  .pipe(
    operator1,
    operator2,
    operator3
).subscribe()

Is there something lost in doing the first thing over the second? I am probably missing some crucial information here and maybe it's very obvious, actually. Thanks for the help.

like image 874
Vlad Pintea Avatar asked Sep 05 '25 02:09

Vlad Pintea


1 Answers

certainly they are equal and they have same result.

both of them is equal to

operator3(operator2(operator1(observable))).subscribe()
like image 167
Hamid Taebi Avatar answered Sep 08 '25 05:09

Hamid Taebi