我有一个如下定义的根级路由器存储。
export interface RouterStateUrl {
url: string;
queryParams: Params;
params: Params;
}
export interface State {
routerReducer: RouterReducerState<RouterStateUrl>;
// init: fromInit.InitState;
}
export const reducers: ActionReducerMap<State> = {
routerReducer: routerReducer,
// initReducer: fromInit.reducer
};
export const getRouterState = createFeatureSelector<
RouterReducerState<RouterStateUrl>
>("routerReducer");
我正在尝试添加一个称为init
的附加状态,我想与路由器状态一起进行跟踪。如何创建也可以访问init状态的功能选择器?换句话说,如何创建未与RouterReducerState类型绑定的功能选择器?
答案 0 :(得分:0)
就像您对路由器所做的一样:
export interface State {
routerReducer: RouterReducerState<RouterStateUrl>;
initReducer: fromInit.State;
}
export const reducers: ActionReducerMap<State> = {
routerReducer: routerReducer,
initReducer: fromInit.reducer
};
export const getRouterState = createFeatureSelector<
RouterReducerState<RouterStateUrl>
>("routerReducer");
export const getInitState = createFeatureSelector<
fromInit.State
>("initReducer");