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
Based on this:https://netbasal.com/listening-for-actions-in-ngrx-store-a699206d2210 with some small modifications, as since ngrx 4 there is no Dispatcher anymore, but instead ActionsSubject:
import { ActionsSubject } from '@ngrx/store';
import { ofType } from "@ngrx/effects";
subsc = new Subscription();
constructor(private actionsSubj: ActionsSubject, ....) {
this.subsc = actionsSubject.pipe(
ofType('SAVE_POST_SUCCESS')
).subscribe(data => {
// do something...
});
}
ngOnDestroy() {
this.subsc.unsubscribe();
}