I have to ways of doing the same thing, although I prefer the first one. But the first approach doesn\'t seem to work. (the tap()
is not triggered)
pipe
creates new Observable
thus you must asssign it and then subscribe to that isntance. In your case you are ommiting pipe
return thus you end up with plain, unmodified Observable
without any extra pipe actions.
Also remember that most likely you will have to subscripbe in order to pipe
(and tap
) to work.
try
this.actions$=this.actions$.pipe(
tap(()=>console.log("First tap")),
ofType(LayoutActions.Types.CHANGE_THEME),
takeUntil(this.destroyed$),
tap(() => {
console.log('Last tap')
}),
);
this.actions$.subscribe(() => {
console.log('subscribtion')
});