title: Cancel an Rx Observable interval call
body: <p>I'm new to Angular 2 so maybe this is trivial - I'm trying to figure out how to cancel an Rx.Observable interval call that happens every 2 seconds. I subscribe to the Rx.Observable with this:</p>
  
  <pre><code>getTrainingStatusUpdates() {
      this.trainingService.getLatestTrainingStatus('train/status')
          .subscribe(res =&gt; {
              this.trainingStatus = res;
              if (this.trainingStatus == "COMPLETED") {
                  //Training is complete
                  //Stop getting updates
              }
          });
  }
  </code></pre>
  
  <p>This is how my Rx.Observable interval call is handled in my service.ts file (this is called by the function above from a different file): </p>
  
  <pre><code>getLatestTrainingStatus(url: string) {
      return Rx.Observable
          .interval(2000)
          .flatMap(() =&gt; this._http.get(url))
          .map(&lt;Response&gt;(response) =&gt; {
              return response.text()
          });
  }
  </code></pre>
  
  <p>As you can see in the subscription method, I simply want to stop the interval calls (every 2 seconds) when 'trainingStatus' is 'COMPLETED'. </p>