我是ng2-flux的初学者。我已经实现了一个员工商店,它需要调用员工数据库以获得相同的INITIAL_STATE。我如何或在何处放置它。
employee.types.ts -
import { TypedRecord, makeTypedFactory } from 'typed-immutable-record';
import { IEmployee } from "../../common/models";
export interface IEmployeeState extends Array<IEmployee> { }
// const INITIAL_STATE =
employee.reducer.ts -
import { IEmployee } from "../common/models/index";
export const EmployeeReducer = (state: Array<IEmployee> = null, action: any) => {
switch (action.type) {
case action.ADD_EMPLOYEE:
return [...state, action.payload]
default:
return state;
}
}
我需要调用初始API来初始化状态。因为它不是Angular2服务而且它只是一个减速器。我该怎么做呢 。