title: Nested API Requests with rxjs on Angular
body: <p>I'm new in rxjs and after readed tons of articles I feel a bit confused.
  I have a lot of nested http requests,that fetch data from the API.
  First request gets the list of my devices, every device contains a list of sensors, every sensor contains a list of temperatures.
  The first API request returns the devices list with sensors array filled, but the temperatures array are empty. At this point I must do one http request for each sensors to fetch temperatures data.</p>
  
  <p>I tried to use switchmap combined with forkJoin, but in the observable subscription I obtain only the arrays of temperatures.
  How can I fill temperatures arrays of each sensor?</p>
  
  <pre class="lang-js prettyprint-override"><code>APIconnector.GetDevices()
      .pipe(
        tap(devices =&gt; {console.log(devices)}),
        switchMap(devices =&gt; forkJoin(devices.map(device =&gt; device.Sensors))),
        tap(sensors =&gt; {console.log(sensors)}),
        switchMap(sensors =&gt; forkJoin(sensors.map(sensor =&gt; {
          const param = {
            MinutesInterval: 30,
            StartDate: stDate,
            EndDate: new Date(),
            SensorIds: [sensor.Id]
          };  
          return APIconnector.GetIntervalRange(param);
        })))
      ).subscribe(data =&gt; {      
        console.log(data);
      })
  </code></pre>
  
  <p>I need all the data returned by the API, not only the last one.</p>
  
  <p><strong>-- UPDATE --</strong></p>
  
  <p>I hope this stackblitz sketch can help you.</p>
  
  <p><a href="https://stackblitz.com/edit/angular-txtemn" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-txtemn</a></p>