1
const sites$: Observable<ISiteData<IRoleData>[]> = this.store.select('auth', 'user', 'sites');

sites$.pipe(
            tap((x) => console.log(x)),
            takeUntil(this.unsubscribe$$),
        );
sites$.subscribe((val: any) => console.log(val)).unsubscribe();

In this situation, the subscribe method is printing the entire object returned. The pipe is not printing anything. How / Why is this going wrong ?

I need to be get the both of them to work the same way.

Dhruv
  • 645
  • 9
  • 17
  • 1
    Does this answer your question? [Difference between the methods .pipe() and .subscribe() on a RXJS observable](https://stackoverflow.com/questions/51269372/difference-between-the-methods-pipe-and-subscribe-on-a-rxjs-observable) – PsyGik Jul 12 '21 at 18:12
  • I added some clarification to the question which the answer below addresses better than the original answer. – Dhruv Jul 12 '21 at 20:28

1 Answers1

2

Because pipe creates new wrapped obserable that you should subscribe to.

What you should do is

observable.pipe(....).subscribe();
Antoniossss
  • 31,590
  • 6
  • 57
  • 99