title: RxJS zip and pipe in combination not working
body: <p>I have two server calls that I need to wait for. However, the user can decide if the second server call is even made. All of this is happening in an Angular Resolver, as the data is necessary for the next page.</p>
  
  <p>The problem is that from my zip function the code never reaches the pipe, leaving me stuck in the resolver. Here is the procedure:</p>
  
  <ol>
  <li><p>zip my requests</p></li>
  <li><p>pipe them </p></li>
  <li><p>and return an observable to my resolve function</p></li>
  </ol>
  
  <p>this is my code:</p>
  
  <pre><code>public resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
      Observable&lt;any&gt; | Promise&lt;any&gt; { //
  
      const id = +route.paramMap.get('id');
      const wantsSecondRequest = +route.paramMap.get('wantsSecondRequest');
  
  
      const requests: Array&lt;Observable&lt;any&gt;&gt; = new Array();
  
      requests.push(firstServerCallHappensHere());
      if (wantsSecondRequest === 1) {
        requests.push(secondServerCallHappensHere());
      }
  
      return zip(requests).pipe(take(1), mergeMap(([a, b]) =&gt; {
           // DO STUFF WITH MY REQUESTS
            return of(a);
      }));
  </code></pre>
  
  <p>}</p>
  
  <p>I tried it with Promise.all and working with Promises instead of Observables, but the issue with those are that I am unable to never complete the Promises in the case of an error, so that the navigation never happens. </p>