【发布时间】:2019-05-14 19:38:59
【问题描述】:
我想放置一个条件,以便在嵌套管道条件中不满足条件时忽略操作事件。
如果我只返回ignoreElements,则会导致返回值不流式传输的错误。
export const getDataEpic: (action$, state$,
{ apolloClient, services }: { apolloClient: ApolloClient<any>, services: any }) => any
= (action$, state$, { apolloClient, services }) =>
action$.pipe(ofType('TEST)).pipe(map(x => x))
.pipe(
switchMap((action) =>
of([true, false, true]))
.pipe(
map(settings => ({ action, config: settings})), // true or false
switchMap(value=> {
if(value.config)
return of([1])
} else {
// if condition not met then don't emit anything
return ignoreElements();
}
}),
),
),
groupBy(value => value.action.payload.model.resource),
mergeMap(ngroup => ngroup
【问题讨论】:
标签: observable rxjs6