问题
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