Reputation: 89
Example:
const data$ = of(777).pipe(
publishReplay(1)
);
data$.subscribe(x => console.log(x));
Expected printing "777" to console. Actual: console is empty:(
Upvotes: 0
Views: 46
Reputation: 1960
You're missing data$.connect();
after your subscription.
Alternatively you can use the refCount
operator after publishReplay
to do this for you automatically.
Upvotes: 2