title: how to get html elements created with an ngfor loop
body: <p>Hello everyone here is a simplification of my problem</p>
  
  <p>I created elements in my template using *ngfor</p>
  
  <pre><code>&lt;table &gt;
    &lt;thead&gt;
    &lt;tr&gt;
      &lt;th *ngFor="let item of array" &gt; {{item}}&lt;/th&gt;
    &lt;/tr&gt;
    &lt;/thead&gt;
  
   &lt;/table&gt; 
  </code></pre>
  
  <p>in the .ts file I have the table</p>
  
  <pre><code>array = [1,2,3,4];
  </code></pre>
  
  <p>and then when I try to display the elements in the console</p>
  
  <pre><code>  var cells = document.getElementsByTagName('th'); //or getElementById or anything..
    console.log(cells[1]);
  
  </code></pre>
  
  <p>it displays
  <strong>undefined</strong></p>