ngrx:针对减速器的两次初始动作

时间:2017-05-24 19:09:29

标签: angular typescript ngrx

rgb2gray

日志输出:

  

firstReducer对象类型:" @ ngrx / store / init" proto :对象

     

secondReducer对象类型:" @ ngrx / store / init" proto :对象

     

firstReducer对象类型:" @ ngrx / store / init" proto :对象

     

secondReducer对象类型:" @ ngrx / store / init" proto :对象

即。对于firstReducer和secondReducer,@ ngrx / store / init动作都被触发了两次。

这种行为的原因是什么?它有the open issue

1 个答案:

答案 0 :(得分:2)

在商店模块中,您使用StoreModule.provideStore(reducers)初始化商店。然后你在主模块中导入了商店模块。它使它初始化两次。您应该只在主模块中添加StoreModule.provideStore(reducers)

相关问题