ng2-redux

In angular (v5) how do I listen to my apps Redux state object changing?

白昼怎懂夜的黑 提交于 2019-12-30 12:13:30
问题 I need to know how to create a listener e.g. I want to subscribe to the AppState changing. Below is my current very basic service. I have a dispatch action on the view which increments the counter. Once the counter changes value I'd like to detect this in other parts of my website e.g. the global header for example. I'm using ng2-Redux with angular version 5. Redux service: export interface IAppState { counter: number; } export const INITIAL_APP_STATE: IAppState = { counter: 0 }; export

In angular (v5) how do I listen to my apps Redux state object changing?

你说的曾经没有我的故事 提交于 2019-12-01 12:13:58
I need to know how to create a listener e.g. I want to subscribe to the AppState changing. Below is my current very basic service. I have a dispatch action on the view which increments the counter. Once the counter changes value I'd like to detect this in other parts of my website e.g. the global header for example. I'm using ng2-Redux with angular version 5. Redux service: export interface IAppState { counter: number; } export const INITIAL_APP_STATE: IAppState = { counter: 0 }; export function appReducer(state: IAppState, action: any): IAppState { switch (action.type) { case 'INCREMENT':

Using Redux in angular 5 how do I get the browser to remember the previous save state on refresh

核能气质少年 提交于 2019-11-28 06:28:51
问题 Currently, on refresh, I loose the saved state. I'm not sure if I need to do anything in the app module . I'm using angular5, typescript, webpack with ng2-Redux and Redux . This is my current app module class: export class AppModule { constructor(ngRedux: NgRedux<IAppState>) { ngRedux.configureStore(rootReducer, INITIAL_APP_STATE, [ createLogger() ]); } } I'm not sure if I need to getState on load of the app. Currently the default INITIAL_APP_STATE is always set thus loosing the stores state