我正在尝试使用ngrx的路由器商店
/模块
@NgModule({
imports: [
....
StoreModule.forRoot(reducers)
StoreRouterConnectingModule.forRoot(),
...
],
....
})
/店铺
import { getSelectors, RouterReducerState } from '@ngrx/router-store'
const selectRouter = createFeatureSelector<RouterReducerState>('router');
const { selectQueryParam } = getSelectors(selectRouter);
export const selectedId = selectQueryParam('id'); //error after subscribing
但是当我订阅任何selectRouter
选择器时,例如selectQueryParam
,我得到错误
Cannot read property 'firstChild' of undefined
因为我的routerState
对象没有root
属性...
我在谷歌上能找到的最接近的是https://github.com/ngrx/platform/issues/2153
知道如何解决这个问题并使用我的路线选择器吗?