如何将 reducer 分离成多个 NgModule?

How to separate reducers into multiple NgModule?

对于效果,我可以这样分开:

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


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

然后在MainModule.

中导入这两个模块

现在我想分离Reducers。现在我将所有减速器放在 MainModule:

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

我试过了,但是不行。

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

有办法分开吗?谢谢

哦,刚刚在 GitHub 上发现了问题。

目前还不可能,但正在计划中。

请跟踪here