title: Angular 2 Observable.forkJoin with for loop
body: <p>This is how i am working now:</p>
  
  <pre><code>getTwoObjectById(url1: string, id1: string, url2: string, id2): any{
    return Observable.forkJoin(
      this.http.get(url1 + `/${id1}`, this.jsonWebToken()).map(res =&gt; 
        res.json()),
      this.http.get(url2 + `/${id2}`, this.jsonWebToken()).map(res =&gt; 
        res.json())
    );
  }
  </code></pre>
  
  <p>I want to prevent this kind of function with id1, url1, id2, url2, id3, url3...</p>
  
  <p>I am trying to write a function that should take as params an Array of IDs and an Array of URLs. With <code>Observable.forkJoin</code> the for loop should execute each request getById to Backend-URL that are in Array.
  My problem is by the for loop</p>
  
  <pre><code>getObjectsById(ids: Array&lt;string&gt;, urls: Array&lt;string&gt;): Observable&lt;any&gt;{
    return Observable.forkJoin(
  
    for(let i = 0; i++; i&lt;ids.length) {
  
       this.http.get(urls[i] + `/${ids[i]}`, this.jsonWebToken()).map(res =&gt; res.json());
  
    }
  
   )
  }  
  </code></pre>
  
  <p>How can I do that?</p>