【发布时间】:2020-06-06 13:28:30
【问题描述】:
我希望 F1() 等到 F2() 完全执行并获得休息呼叫响应并设置一些数据。
我用这个代码试过
this.F1().subscribe(result => {
this.F2(result);
})
F1() {
return this.graphDataService.getAvailableSpan(a, b).subscribe(res => {
this.c = new Date(res.lastAvailableDate);
return 1;
}, error => {
this.lastAvailableDate = new Date();
return 1;
})
}
【问题讨论】:
-
你尝试过 promises 或 acync await
-
我试过了,但是出错了,我确定我写错了代码
-
您不能订阅订阅。
标签: javascript angular typescript