【发布时间】:2018-06-20 09:18:25
【问题描述】:
我有一个效果类,我想根据路由器参数 ID 加载详细信息
@Effect()
getDetails$ = this.actions$.ofType(DetailActions.GET_DETAILS).pipe(
map(toPayload),
switchMap(payload => {
return this.detailService
.getDetail(payload)//I want router params here in payload
.pipe(
map(detail=> new DetailActions.GetDetailSuccess(detail)),
catchError(error =>
Observable.of(new DetailActions.GetDetailFail(error))
)
);
})
);
我想在payload中获取路由器参数,这样我就不用从组件中传递payload,而是直接从效果类中获取。
【问题讨论】:
标签: angular ngrx ngrx-store ngrx-effects ngrx-store-4.0