比如有多个http请求:
this.http.get(url1).subscribe(res1=>console.log(res1))
this.http.get(url2).subscribe(res2=>console.log(res2))
this.http.get(url3).subscribe(res3=>console.log(res3))
请问es6/rxjs中有没有什么写法可以等待三个请求结束,然后再进行处理呢?
我在网上找了好几个方案,试了一下都不好使
let http1 = this.http.get(url1).subscribe(res1=>console.log(res1))
let http2 = this.http.get(url2).subscribe(res2=>console.log(res2))
let http3 = this.http.get(url3).subscribe(res3=>console.log(res3))
Observable.fornJoin([http1,http2,http3]).subscribe(res=>console.log(res))
Observable.zip(http1,http2,http3).subscribe(res=>console.log(res))
Observable.merge([http1,http2,http3]).subscribe(res=>console.log(res))
请问该如何实现呢?
解决了https://my.oschina.net/eima/blog/1797481