access value of array by its index in Angualar ngFor directive


I have a requirement to access the value of array item by index in ngFor directive angular

Let say i have entityList array.i also have columnNames array which gives me number of td’s to generate. so columnNames acts as a table header and entityList has data for it to display in tabular format.

    "Id": 1,
    "Name": "Admin",
    "Id": 2,
    "Name": "Finance",


<table class="table">
      <th *ngFor="let column of columnNames" scope="col">

    <tr *ngFor="let entity of entityList">
      <td *ngFor="let column of columnNames;let i = index">


i know i can do it like below , however i want to print the value using index and not by name.

<tr *ngFor="let entity of entityList;let i = index">

Source: Angular Questions

Categorized as angular, ngfor Tagged ,


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us