title: Execute function after DOM has finished rendering
body: <p>I recall reading the excerpt below from a blog.</p>
  
  <blockquote>
    <p>$timeout adds a new event to the browser event queue (the rendering engine is already in this queue) so it will complete the execution before the new timeout event.</p>
  </blockquote>
  
  <p>I'm wondering if there is a better way in angular/ javascript than using </p>
  
  <pre><code>setTimeout(() =&gt; {  
      // do something after dom finishes rendering
  }, 0);
  </code></pre>
  
  <p>to execute code when the DOM has completely finished a task such as updating an *ngFor and rendering the results on the page.</p>