I have a static set of data, a list of countries, that are used on some components. This data is loaded upon the ngOnInit() of these components but I\'d like to
You can select the countries from the store within effects, if they are represented in the store we ignore the action, if not we fetch the countries.
@Effect()
getOrder = this.actions.pipe(
ofType(ActionTypes.GetOrder),
withLatestFrom(this.store.pipe(select(getOrders))),
filter(([{payload}, orders]) => !!orders[payload.orderId])
mergeMap([{payload}] => {
...
})
)
For more info see Start using ngrx/effects for this.