title: How to show a loader for 3 sec and hide in angular 2
body: <p>I want a loader show for 5 sec and hide when i click on a button,
  so far i tried</p>
  
  <pre><code>&lt;div *ngIf='showloader'  class="form-group loaderformgroup maindivdisplaynone" id="waitresponce" &gt;
      &lt;div class="waitresponce"&gt;
           &lt;img src="assets/img/loader.gif" img-from="assets" alt="loader" class="waitresponceloader"/&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  
   resetform() {
          this.student = {};
            Observable.timer(500).subscribe(() =&gt; {
                          $('#tablebody').addClass('fadding');
                          this.showloader = true;
                          Observable.timer(500).subscribe(() =&gt;  
                          $('#tablebody').removeClass('fadding'); 
                          this.showloader = false 
                          );   
                          });
      }
  </code></pre>
  
  <p>my ts,</p>
  
  <pre><code>       setInterval(() =&gt; {  
    this.showloader = true;
  }, 2000);
  </code></pre>
  
  <p>But it is showing loader after 2000.Can someone please help.Thanks.</p>