title: How stop interval timer?
body: <p>How stop interval when you move to another component in Angular 7:</p>
  
  <pre><code>public s: Observable&lt;any&gt;;
  
  this.s = interval(5000)
        .pipe(takeWhile(() =&gt; this.visitors.length &gt; 0))
        .subscribe(() =&gt; {});
  </code></pre>
  
  <p>I tried to stop interval in component destructor:</p>
  
  <pre><code>   ngOnDestroy() {
        this.s.unsubscribe();
    }
  </code></pre>