Closed tommueller closed 6 years ago
Hello @tommueller Basically that's all, register the dispatching the action. What are your action constructor arguments? Can you post the data and schema you pass to the action?
Thanks for the reply. Will post this on Monday, I'm not in office tomorrow. Thanks!
Sorry, closed incidentally. Did you register the reducer to the store? And remember: data needs to be an array.
data is an array, when I look at the payload of the dispatched action, it looks fine.
how do I register the reducer to the store? Maybe I missed that part ...
In you module definition:
@NgModule({
imports: [
...
StoreModule.forRoot(reducers) // or StoreModule.forFeature(...)
],
...
})
export class AppModule ...
@michaelkrone thanks I got it running! In my module definition I had the import like this:
StoreModule.forRoot({ templateState: templateReducer })
Changed it to StoreModule.forRoot(templateReducer)
and now it is working fine.
Cheers!
Thanks for the great library! Looks super useful. I do have one issue though. I set everything up as in the README, but I am not using Effects() to pass in data, because the data is generated on the client side. So I use
myStore.dispatch(new AddData<Data>()
to add data.Looking in ngrx-devconsole I can see that the action is going to the store with the correct payload, but my state does not change. It is always empty ...
I just have this as reducer and state:
export interface TemplateState extends NormalizedState { } export const templateReducer: ActionReducerMap<NormalizedState> = { normalized };
Am I missing anything?
Thanks! Tom