So we come to the effect. Our effect acts like a listener to a dispatched action. This gives us the opportunity to carry out a unit of work, but also to dispatch an action once that work is done.
We have created all the usual bits that we are used to, so now it is time to create our effect that will handle the entire workflow:
// product/product.effect.tsimport { Actions, Effect } from "@ngrx/effects";@Injectable()export class ProductEffects { @Effect() products$: Observable<Action>; constructor( private actions$: Actions<Action>> ) {}}
The effect is just a class decorated with the @Injectable decorator. It also contains two members: one member of Actions type and another of the Observable<Action> ...