title: How to call a function after HTML content refresh in angular2?
body: <p>When I hit an api to get data from server in constructor and store it in local variable. I loop this variable in html to build table and show data in table. But when I call a function on api success and in it I loop the same variable which is used in HTML, the loop in function will run first and after that HTML loop. My requirement is to run HTML loop first and after its completion loop in function.</p>
  
  <p>HTML CODE</p>
  
  <pre><code>&lt;table&gt;
     &lt;tr *ngFor="let booking of jobHistory&gt;
        &lt;td&gt;{{booking}}&lt;/td&gt;
     &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>TYPESCRIPT CODE </p>
  
  <pre><code>jobHistory : any;    
  constructor()
  {
    this.service.getCustomerJobHistory().subscribe(   res =&gt; { this.jobHistory = res},
                                                      err =&gt; console.log(err),
                                                      () =&gt; this.setRating()
                                                );
  
  
  }
  
  setRating()
  {
     //I want to run this loop after HTML loop completion.
     for(let booking of this.jobHistory)
     {
       console.log(booking);
     }
  }
  </code></pre>