In my current project, I have an array of objects that I am displaying in a table using the ng-repeat
directive.
<table>
<thead>
<tr>
<th ng-repeat="col in columnHeaders">{{col}}</th> //['Name', 'Bank Name','Code', 'Type','Status'];
</tr>
</thead>
<tbody>
<tr ng-repeat="row in data track by $index">
<td ng-repeat="col in columnRows">{{row[col]}}</td> //['name', 'bankName','code', 'type','isActive'];
</tr>
</tbody>
</table>
Although I am using ng-repeat
on both the <th></th>
and <td></td>
elements, I encountered an issue where the names of my columnHeaders
and row properties (columnRows
) are different. I wanted to align the property name with the column header name while using ng-repeat
on the <td></td>
tag.
I considered using an alias with 'as' but was unsure how to implement it for each element.
Can anyone provide guidance or assistance?