title: Script to automatically click a button repetitively in Angular
body: <p>I have a button that needs to be pressed repetitively every 5 seconds automatically.</p>
  
  <p>The button is defined as :</p>
  
  <pre><code>&lt;button id="refresh" class="btn- fa fa-refresh" aria-hidden="true" value="referesh" (click)="ngOnInit()"&gt;&amp;nbsp; Refresh&lt;/button&gt;
  </code></pre>
  
  <p>After looking for solutions I wrote this code:</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  setInterval(function(){
    $('#refresh').trigger('click');
  }, 5000);
  &lt;/script&gt;
  </code></pre>
  
  <p>Though the above script worked in a HTML env., it didn't work in the angular scenario.</p>
  
  <p>I am completely new to Angular and can't figure out how to do this. Any help would be highly appreciated!</p>