Hi everyone In my curre…

less than 1 minute read

Hi everyone! In my current setup I’ve got an Angular application using NgRX and a NgModule in a library also using NgRX. How can I dispatch an action that is defined in the root store from inside the library? Problem is that I cannot easily import anything from the app into the library. I thought about using injection tokens, but I didn’t come to a solution for now. The other way would be to define effects in the root store that listen to actions of the library and dispatch the action of the root store. Do you have any ideas? Thanks in advance!

Responses:

Maybe you can extract the RootStore with its actions in a library which is the imported by your app and exports the action for your other library

Thanks, went for your solution, works flawlessly.

Updated: