我有多个数据要在我的网站上初始化,所以我创建了一个多订阅。
我的问题是,当没有发现错误时,第一个subscribe是否会等待完成所有的subscribe,直到它转到complete()?
这是一个例子
myFirstService.subscribe(
data =>{
mySecondService.subscribe(
data =>{
codes
}
)
},
error =>{},
() => {} <---------- will this () wait for the second service to finish?
)发布于 2020-08-13 14:57:45
不,如果你想等待第二个可观察对象完成,你需要处理其中的逻辑。
示例:
myFirstService.subscribe(
data =>{
mySecondService.subscribe(
data =>{
codes
},
() => { // do stuff after second observable finishes }
)
},
error =>{},
() => {} <---------- this will not wait for the second observable, only for the first
)https://stackoverflow.com/questions/63389675
复制相似问题