2016-09-21 4 views
0

filterObservable을 반환하는 각도 서비스가 있습니다.RxJS - zip 다중 구독 결과가 ts 컴파일러 오류

Rx.Observable.zip()을 통해 여러 통화를 결합하고 싶습니다.

이 예상대로 작동하지만 내 타이프 라이터 컴파일러 내 방법에 대한 오류가 발생합니다 :

error TS2346: Supplied parameters do not match any signature of call target.

당신이 나에게 힌트를 줄 수있는, 내가 잘못하고 어떻게 오류를 해결하는 방법입니다 무엇?

protected getCombinedResults(ids:number[]) { 
    let observablesToGetZipped = ids.map(id => this.myService.loadResource(id)); 

    if (observablesToGetZipped.length > 1) { 
     return Rx.Observable 
     .zip(observablesToGetZipped) 
     .take(1); 
    } 

    return observablesToGetZipped[0].take(1); 
    } 

나는 방법과 같이 호출 솔루션에 관심이있는 사람들을위한

this.getCombinedResults([1,2,3,4,5]).subscribe(result => { ... }); 

답변

0

:

이 한 나

return Rx.Observable 
    .zip.apply(Rx.Observable, observablesToGetZipped) 
에 대한 트릭