title: How to get attribute value inside li tag?
body: <p>I am using angular 6 application where i am passing data through attribute,</p>
  
  <p>First i have given <code>[attr.parent_id]</code> in ul tag like,</p>
  
  <pre><code>&lt;ul class="list-unstyled" id="1" [attr.parent_id]="123"&gt;&lt;/ul&gt;
  </code></pre>
  
  <p>For which i have used, <code>console.log(target.getAttribute('parent_id'));</code></p>
  
  <p>And the result displays <code>123</code>.</p>
  
  <p>Like same thing i need to get a index number from <code>li</code> tag like of the same <code>ul</code>,</p>
  
  <pre><code>&lt;ul class="list-unstyled" id="1" [attr.parent_id]="123"&gt;
        &lt;li class="media p-2 column" *ngFor="let item of items;let i = index;" [attr.child_id]="i"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Here i have given <code>[attr.child_id]</code> to retrieve the index position and i have used <code>console.log(target.getAttribute('child_id'));</code>.</p>
  
  <p>This console of getting <code>child_id</code> displays the value as <strong>null</strong>.</p>
  
  <p>The ul tag gives me the value of attribute but li tag is returning null as result.</p>
  
  <p>The <strong>StackBlitz</strong> link was <a href="https://stackblitz.com/edit/angular-oaghq3" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-oaghq3</a></p>
  
  <p>Kindly help me to set and get the attribute to li tag and to retrieve data.</p>