I am facing a similar situation as described in the example below, and I need to generate a serial number for each row independently for each mark record.
Here is the Java script Object structure:
$scope.childsList = [
{
id:12346,
name : 'Sagar Kulthe',
marksList : [{subject:'Math', marks: 55}, {subject:'English', marks: 54},
{subject:'Biology', marks: 65},
{subject:'Physics', marks: 78}]
},
{
id:12346,
name: 'Amol Pawal',
marksList : [{subject:'Math', marks: 55}, {subject:'English', marks: 54},
{subject:'Biology', marks: 65},
{subject:'Physics', marks: 78}]
},
{
id:12346,
name: 'Tushar Shah',
marksList : [{subject:'Math', marks: 55}, {subject:'English', marks:
54}, {subject:'Biology', marks: 65},
{subject:'Physics', marks: 78}]
}
];
Below is the View structure:
<table>
<thead>
<th>Sr NO:</th>
<th>Name</th>
<th>Subject</th>
<th>Marks</th>
</thead>
<tbody ng-repeat="child in childsList track by $index">
<tr ng-repeat="mark in marksList track by $index" ng-init="marksIndex = $index">
<td>{{marksIndex }}</td>
<td>{{child.name}}</td>
<td>{{mark.subject}}</td>
<td>{{mark.marks}}</td>
</tr>
</tbody>
</table>