title: How to use the 'flatmap' operator conditionally ? (Angular 2/rxjs)
body: <p>What I'm trying to achieve is to run a series of observables conditionally.</p>
  
  <pre><code>return observable.map(response =&gt; response)
         .flatmap(response1 =&gt; observable1(response1))
         .flatmap(response2 =&gt; observable2(response2))
         .flatmap(response3 =&gt; observable3(response3))
  </code></pre>
  
  <p>I need to check the response1 and invoke the remaining observables if needed, else I need to return response1 and break the execution and so on. </p>
  
  <p>I've gone through the following SO questions but they doesn't seem to answer my question</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/40273065/conditionally-choose-observable-in-rxjs">Conditionally choose observable in RxJS</a></p>
    
    <p><a href="https://stackoverflow.com/questions/34728827/rxjs-if-with-observable-as-conditional">RXJS if with observable as conditional</a></p>
    
    <p><a href="https://stackoverflow.com/questions/41946077/handle-error-in-rxjs-flatmap-stream-and-continue-processing">Handle Error in RxJs flatMap stream and continue processing</a></p>
  </blockquote>
  
  <p>I'm new to rxjs, so forgive me if the question seems too lame.</p>
  
  <p>Any help will be appreciated. </p>
  
  <p>Thanks</p>