rxjs with multiple forkjoin when doing http requests
<p>I am doing some http requests and use rxjs for successfull notification of the result:</p>

<pre><code>  getReportings(departmentId: number): Observable&lt;any&gt; {
        return Observable.forkJoin(
            this.http.get('/api/members/' + departmentId).map(res =&gt; res.json()),
            this.http.get('/api/reports/' + departmentId).map(res =&gt; res.json())
        );
    }
</code></pre>

<p>When both http requests are done I want inside the getReportings method to iterate the reports array , read some values and for each report make again a new http request with those values.</p>

<p>All in all I have 2 (member/reports) + appr. 4 to 8 (other stuff) requests.</p>

<p>When all appr. 6 to 8 requests are done I want to get ALL data from the previous 6 to 8 requests in the successfull handler.</p>

<p>How can I do this with rxjs?</p>

<p>UPDATE</p>

<p>As user olsn asked for more details and I understand him now whats his concern I put more data here (<strong>pseudo code</strong>) how the 6 to 8 requests should look like:</p>

<pre><code>getReportings(departmentId: number): Observable&lt;any&gt; {
    return Observable.forkJoin(
        this.http.get('/api/members/' + departmentId).map(res =&gt; res.json()),
        this.http.get('/api/reports/' + departmentId).map(res =&gt; res.json())
    ).switchMap((result: [any[], any[]]) =&gt; {
        let members: any[] = result[0];
        let reports: any[] = result[1];
        let allNewStreams: Observable&lt;any&gt;[] = [
            Observable.of(members),
            Observable.of(reports)
        ]; 

        for(let report of reports)
        {
            allNewStreams.push(
this.http.get(report.url + ?key1=report.name1?).map(res =&gt; res.json()));
        }


        return Observable.forkJoin(allNewStreams); // will contain members, reports + 4-6 other results in an array [members[], reports[], ...other stuff]
    });
}
</code></pre>