我想取消在角度 8 中的 RXJS 效果中发出的 http 请求。
@Effect() getReport$ = this.action$.pipe(
ofType(ActionTypes.GET_WIDGET),
map(toPayload),
mergeMap(payload => {
return this.dashboardService.getReport(payload).pipe(
map(this.extractData),
switchMap(result => {
return observableOf(<ReceivedWidgetAction>{
type: ActionTypes.RECEIVED_WIDGET,
payload: result
});
}),
catchError((err: Response | any) => {
return this.handleReportError(err);
}));
}));
请让我知道如何使用 angular 8 来做同样的事情。另外请注意,我将无法使用 switch map,因为多个小部件 angular 组件将使用不同的有效负载调用此操作。