I develop the application with angular and ngrx.
How get a state in feature module?
this.todos$ = this.store.select(state => state.todos.data)
I use this tutorial but I cannot understand what is fromStore
if your reducer.ts export that
export function myList(state = [], action: Action) {
switch (action.type) {
case 1:
return data1;
case 2:
return data2;
default:
return state;
}
}
your store.model.ts must be this:
export interface AppStore {
myList: element[];
...
}
and you can get the state like this :
constructor(private store: Store<AppStore>) {}
this.todos$ = this.store.select("myList")
that will return an Observable of elements array