title: Need a callback when it is OK to access the DOM
body: <p>I have an Angular component that fetches markdown, converts it to HTML, then inserts it into the DOM.  After insertion it does some more DOM manipulation.   So the template is this:</p>
  
  <pre><code>&lt;div id="fixroot" [innerHTML]="content"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and the component is like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>    content: string;
  
      ...
  
      async getPage(url: string) {
         try { 
             this.content = this.mdToHtml(await this.http.get(url, { responseType: 'text'}).toPromise();
             setTimeout(() =&gt; this.fixupDOM(), 400);
  
      ....
  
      fixupDom() {
         const el = document.getElementById('fixroot');
         // do stuff to the DOM element that are children of el
  
  
  </code></pre>
  
  <p>The use of <code>setTimeout</code> here is really awful, but without it the <code>fixupDom</code> method doesn't work
  because the DOM is not ready when the Promise concludes.  But it has to go.   </p>
  
  <p>What I need is a callback (probably from the HTMLElement
  <code>el</code>) that calls my routine as soon as the DOM structure is ready.  I haven't been able 
  to make anything work.   Anyone know the right function?</p>