【发布时间】:2016-12-13 02:54:35
【问题描述】:
我在减速器上有以下尝试
import { ActionReducer, Action, Store } from '@ngrx/store';
import { Observable } from 'rxjs'
import { Name } from './name.model'
export const ADD_NAME = 'ADD_NAME';
export const name: ActionReducer<any> = ( state = new Name(), action: Action ) => {
switch ( action.type ) {
case ADD_NAME:
return [ state, action.payload ];
default:
return state;
}
};
我想在 Store 中存储一个 Name 实例。目前 ADD_NAME 返回一个数组。我怎样才能只存储一个实例而不是数组
【问题讨论】:
标签: angular angular2-forms rxjs5 reducers