5

In the NGRX documentation for Router-Store, they only provide an example with .forRoot(). When I tried using .forFeature() I discovered that no such static method exists.

I would like to be able to define certain actions & effects for use within my feature module (and the app module as well).

How does one go about using router-store inside of feature modules?

Kevin Beal
  • 10,500
  • 12
  • 66
  • 92

1 Answers1

1

You don't need to set it up for feature modules. You only need to set it up once by StoreRouterConnectingModule.forRoot() in your app.module.ts, that's enough.

Envil
  • 2,687
  • 1
  • 30
  • 42
  • 1
    If I'm defining actions and selectors at the app module level and using them in a feature module, then this is a bad design, is it not? – Kevin Beal Jul 04 '18 at 16:19
  • @ManPersonson This is out of the scope of the question. However, FYI, that's a bad design IMO. Each feature module should have its own actions and reducer. See the example app here: https://github.com/ngrx/platform/tree/master/example-app You should follow the smart component dummy component as well. – Envil Jul 04 '18 at 17:16