title: How to find elements by id in ShadowDOM?
body: <p>How can i get a reference to an element in an Angular Component with it's encapsulation set to ShadowDOM?</p>
  
  <pre><code>const element = document.getElementById(id); 
  </code></pre>
  
  <p>for example, returns null</p>
  
  <p>EDIT: Added html snippet</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div *ngFor='let item of items' [attr.id]='item.key'&gt;
  .....
  &lt;/div&gt;
  </code></pre>
  
  <p>I need reference to each of the divs created.</p>
  
  <p>Using a template variable works, but afaik you can not generate template variables dynamically. </p>
  
  <p>E.g.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div #myTarget&gt; ... &lt;/div&gt;
  </code></pre>
  
  <p>works</p>