title: Observables : Cancel previous http request on new subscription call
body: <p>I am working on a search functionality for my project. Once the user types anything on the search bar; on any change in search text I'll be sending the text to backend for validation and receive a response (error or no error in text):</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>this.searchBar.on('change', () =&gt; {
  
      http.post('api_link', {searchText: 
         this.serachBar.searchText}).subscribe(resp =&gt; {
              this.resp = resp['Result'];
         });
      })
  </code></pre>
  
  <p>Now as the user continuously types in the search bar, multiple validation responses are incoming through back-end. However, on any new change only the latest subscription is valid and any previous call to api is useless.</p>
  
  <p>Is there any way I can cancel the previous subscription on any new call to api using subscribe?</p>
  
  <p>Note: It might seem possible to just  wait for all responses but I am also going to display the responses below the search bar(showing a loader till then). So, rather than transition between various response states I want loader to keep loading until the latest response is available. </p>