title: Angular: Cannot read property 'appendChild' of undefined
body: <p>I have a third party component rendered from node modules in my Appcomponent. I want do display a paragraph inside that third party component.</p>
  
  <p>app.component.html</p>
  
  <pre><code>&lt;div id="dashboard" class="content-fluid aui standalone"&gt;
    &lt;cs-sidebar [nav]="navigation" class="candisableNav"&gt;
    &lt;/cs-sidebar&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>Component</p>
  
  <pre><code>ngAfterViewInit() {
      console.log(this.rd); 
      console.log(this.el); 
      let elem = document.getElementsByClassName('sidebar-header__title')
      console.log(elem)
      let a = document.createElement('p');
      console.log(a)
      a.innerHTML = 'Version 0.5';
      console.log(elem.item(0))
      elem.item(1).appendChild(a);
  }
  </code></pre>
  
  <p>In ngAfterViewInit() of AppComponent I'm trying append a p tag into the CsSideBarcomponent. elem = document.getElementsByClassName('sidebar-header__title') is fectching the div tag and I'm able to see in the console. But I'm getting "Cannot read property 'appendChild' of undefined" error for elem.item(1).appendChild(a). I'm pushing to the index 1 as there is already an element at 0th index which I need it. I saw the posts over here and I'm doing in the same way. Any help please</p>