【发布时间】:2018-10-02 13:49:32
【问题描述】:
当使用 withLatestFrom 时,我正在努力将参数传递给选择器,它是之前从加载操作有效负载映射的
loadLocalSubServices$: Observable<Action> = this.actions$.pipe(
ofType(LocalSubServiceTemplateActions.LocalSubServicesTemplateActionTypes.LoadLocalSubService),
map((action: LocalSubServiceTemplateActions.LoadLocalSubService) => action.payload.globalSubServiceId),
// and below I would like to pass globalSubServiceId
withLatestFrom(this.store.pipe(select(fromLocalSubservices.getSearchParams(globalSubServiceId)))),
map(searchParams => searchParams[1]),
mergeMap((params) =>
this.subServiceService.getLocalSubServices(params).pipe(
map(localSubServices => (new LocalSubServiceTemplateActions.LocalSubServiceLoadSuccess(localSubServices))),
catchError(err => of(new LocalSubServiceTemplateActions.LocalSubServiceLoadFail(err)))
)
)
);
【问题讨论】:
-
这是非常混乱的描述。什么有效/无效?