Reputation: 1218
I have angular 7 application using ngrx. I have two laze loaded feature modules. One is overview and another is dashboard module. Overview module want to access the list of dashboards available in the system.
What should be the best practice to share the available dashboard data to the overview module. I don' want the whole dashboard module to be loaded into overview module. How the sharing of the data can be achieve using ngrx store.
I can easily share the data by writing the service and sharing the same between module but i want to see how i can achieve the same using ngrx.
Upvotes: 0
Views: 1675
Reputation: 15505
Selectors! If the module is loaded, you can easily write a selector that uses a selector for Module A and/or B.
const combined = createSelector(
selectFromModuleA,
selectFromModuleB,
(a, b) => ...
)
I've written about this topic in Sharing data between modules is peanuts
Upvotes: 3