title: How to use clearInterval() in Angular 4
body: <p>I am trying to use setInterval in my Angular 4 app.</p>
  
  <pre><code>const inter = setInterval(() =&gt; {
    // logic resulting in exitCondition
    if(exitCondition) {
      clearInterval(inter);
    }
  }, 1000);
  </code></pre>
  
  <p>This set up works fine in vanilla javascript, but <code>clearInterval()</code> does not seem to work in Angular. Upon doing some research I found an interval service for Angular 1.x :</p>
  
  <p><a href="https://docs.angularjs.org/api/ng/service/" rel="noreferrer">https://docs.angularjs.org/api/ng/service/</a>$interval</p>
  
  <p>Is there anything similar for Angular 4? Or is there a workaround to make clearInterval() work?</p>