Vlad Pintea
Vlad Pintea

Reputation: 853

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.

Upvotes: 4

Views: 1549

Answers (1)

Hamid Taebi
Hamid Taebi

Reputation: 397

certainly they are equal and they have same result.

both of them is equal to

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

Upvotes: 5

Related Questions