title: Asynchronous call is returned after onDestroy has been called
body: <p>I have an asynchronous server call that is set up like this. The response to the call, sets up a timer to call itself again in 30 seconds. A problem arises if the user navigates away from the page. Even though this.stopTimer() has been called, if a response is returned after leaving the page, the loop just continues. How can I prevent the next this.startTimer() from being called aftern ngOnDestroy() has been called?</p>
  
  <pre><code>ngOnInit() {
      this.doSomething();
  }
  
  ngOnDestroy(){
      this.stopTimer();
  }
  
  doSomething() {
           var me = this;
  
          this.stopTimer();
          this.service.getStuff().subscribe(
              (response: any) =&gt; {
  
                  ...do stuff
                  this.startTimer();
  
              }
          )
      }
  
  startTimer() {
      var me = this;
      clearTimeout(me.timeoutHandle);
      me.timeoutHandle = setTimeout(function () {
          me.doSomething();
      }, 30000);
  }
  
  stopTimer() {
      var me = this;
      clearTimeout(me.timeoutHandle);
      me.timeoutHandle = null;
  }
  
  </code></pre>