I\'m trying to do simple thing - after some entity saved (using http request) I want to navigate back to list route. The problem is : how to subscribe to success action (or
You can subscribe to actions in components as well:
[...]
import { Actions } from '@ngrx/effects';
[...]
@Component(...)
class SomeComponent implements OnDestroy {
destroyed$ = new Subject();
constructor(updates$: Actions) {
updates$.pipe(
ofType(PostActions.SAVE_POST_SUCCESS),
takeUntil(this.destroyed$)
)
.subscribe(() => {
/* hooray, success, show notification alert etc.. */
});
}
ngOnDestroy() {
this.destroyed$.next(true);
this.destroyed$.complete();
}
}