小编lol*_*ans的帖子

当 ngrx store state 包含 Map 时,为什么无法识别对此 Map 的更改?

我根据他们的示例应用迁移到 Ngrx Store v4.1.1 (+ Angular5)。一切都像以前一样运行良好,但只有一个 SubStore。该 SubStore 的状态包含一个已更改的 Map。但是不知何故无法识别对此地图的更改。

可以在这里找到工作 Plunker:https ://plnkr.co/edit/2Z77Cq?p=preview 下面的详细代码

我的 NgModule 看起来像这样:

import {reducers} from './reducers';

@NgModule({
   imports: [ 
     BrowserModule,
     StoreModule.forRoot(reducers) 
   ],
   declarations: [ App ],
   bootstrap: [ App ],
   providers: [Service]
})
Run Code Online (Sandbox Code Playgroud)

我的减速机看起来像这样:

import {
  ActionReducerMap,
  createSelector,
  createFeatureSelector,
} from '@ngrx/store';

import * as character from './character.reducer';

export interface State {
  character: character.State;
}

export const reducers: ActionReducerMap<State> = {
  character: character.reducer,
};

/** Character **/
export const getCharacterState = createFeatureSelector<character.State>('character');

export const …
Run Code Online (Sandbox Code Playgroud)

ngrx ngrx-store

4
推荐指数
1
解决办法
4065
查看次数

标签 统计

ngrx ×1

ngrx-store ×1