typescript - 如何用未弃用的方法替换 rxJs 中的方法“combineLatest”?
问题描述
我使用combinlatest
rsjx/operator one 实现了方法,它工作正常,但声纳问题说它不推荐使用。所以,我需要将它转换为最新的。但我尝试,只是替换导入它给出了错误。我需要一些专家的帮助才能做到这一点。
gX$ = createEffect(() => this.actions$.pipe(
ofType(ActionType.A),
combineLatest(this.service.getoc()),
mergeMap(([, oc]) => this.reviewService.findBy(oc.id,
new Date(),
new Date(new Date().setDate(new Date().getDate() + 1)))
.pipe(
mergeMap(d => {
return of(reviewLoadSuccess({ reviews: getReviews(d) }));
}
),
catchError(error => {
return of(reviewLoadFailure({ error: error }));
})
)
)));
解决方案
您需要从rxjs
not导入rxjs/oeprators
并像这样使用它:
import { combineLatest } from 'rxjs';
combineLatest([
this.actions$.pipe(ofType(ActionType.A)),
this.service.getoc()
]).pipe(mergeMap(...));
推荐阅读
- angular - 以角度预加载特定组件
- node.js - kafkajs 库无法在远程 kafka 集群中运行
- ios - 在 Swift 中将两个数组合并为一个字典
- authorization - 在 Mongodb Realm 中向 3rd 方服务授权 API 请求
- css - 角度 css 样式的弹性项目垂直顶部
- arrays - 如何区分VBA中变体数组中的字符串和整数
- macos - 从不自动加入网络(mac osx)
- python - 是否可以使用 mathplotlib 在 x 轴上按日期和时间绘制,而不是默认为天?
- rsyslog - 使用文件大小进行日志旋转:Centos7
- assembly - 在我的 VDU(微处理器模拟器)上显示 2 位数字