【发布时间】:2021-09-28 08:48:52
【问题描述】:
我正在学习 RxJS。我有 3 个 api 调用,我需要进行第二个 api 调用,并将其数据作为参数传递给第三个 api 调用。我试过这个:
checkPermission(permissionName: string): Observable<boolean> {
this.check(this.p1)
.pipe(
switchMap(res => {
const shouldCheck = res.Value;
if (shouldCheck.toLowerCase() === 'true') {
return this.checkPermission(permissionName).pipe(
map(result => {
return result;
})
);
} else return of(true);
})
)
.subscribe(permission => {
});
}
但出现语法错误。
【问题讨论】:
-
@AdrianKokot 把那个括号放在哪里,我不明白
-
我只是想把从第二个api得到的数据作为参数发送到第三个api
标签: angular typescript rxjs