title: How do you dynamically change the id of an element in Angular?
body: <p>I have an element in a loop and I just want to change it's id so as to avoid conflicts. I did some searching, but can't seem to find anything.</p>
  
  <pre><code>&lt;div *ngFor="let location of job.tasks; let i = index"&gt;
    &lt;div id="index-{{i}}"&gt;
      {{index}}
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem is when I call in ngOnInit <code>document.getElementById('index-1')</code> it returns null because it hasn't assigned the id yet.</p>