current state in ngrx angular

余生长醉 提交于 2019-12-11 09:10:19

问题


Hi new to ngrx i am trying implement a smaple example for ngrx with angular but i have implemented everything not able to get the current state after service call

So can please help me to get the current state and how many to get the state in ngrx as newbie to ngrx and correct if there are coding needs to improved in other places

I have added the stackblitz link

https://stackblitz.com/edit/angular-gvjoju


回答1:


The reducers added to StoreModule.forRoot() must be an actionmap, for example:

   StoreModule.forRoot({data : TestReducer.TestReducer}),

The reducer should always have a default case to return the current state:

  default:
        return state


来源:https://stackoverflow.com/questions/58779106/current-state-in-ngrx-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!