Hongbo Miao
Hongbo Miao

Reputation: 49704

How to separate reducers into multiple NgModule?

For Effects, I can separate like this:

@NgModule({
  imports: [
    EffectsModule.run(FooEffects)
  ]
})
export class FooModule {}


@NgModule({
  imports: [
    EffectsModule.run(BarEffects)
  ]
})
export class BarModule {}

Then import these two modules in the MainModule.

Now I want to separate Reducers. Right now I puts all reducers in the MainModule:

@NgModule({
  imports: [
    StoreModule.provideStore(
      compose(
        storeFreeze,
        combineReducers
      )({
        foo: fooReducer,
        bar: barReducer
      })
    ),
    // ...
  ],
  // ...
})
export class MainModule {}

I tried this, but not work.

@NgModule({
  imports: [
    StoreModule.provideStore({ foo: fooReducer })
  ]
})
export class FooModule {}

Is there a way to separate it? Thanks

Upvotes: 0

Views: 322

Answers (1)

Hongbo Miao
Hongbo Miao

Reputation: 49704

Oh just found the issue on GitHub.

Right now it is impossible, but is on plan.

Please track here.

Upvotes: 1

Related Questions