Reputation: 3560
i have a table which contains the database values but here i need to add serial no(i.e-1,2,3,4.....
) with values in this table using angular.js.i am explaining my code below.
course.html:
<div class="portlet portlet-blue" style="margin-bottom:12px;">
<div class="portlet-body">
<div class="table-responsive dashboard-demo-table">
<table class="table table-bordered table-striped table-hover" id="dataTable">
<colgroup>
<col class="col-md-1 col-sm-1">
<col class="col-md-2 col-sm-2">
<col class="col-md-2 col-sm-2">
<col class="col-md-2 col-sm-2">
<col class="col-md-2 col-sm-2">
<col class="col-md-2 col-sm-2">
<col class="col-md-1 col-sm-1">
</colgroup>
<thead>
<tr>
<th>Sl. No</th>
<th>Cource Name</th>
<th>Short Name</th>
<th>No of Semester</th>
<th>Edit</th>
</tr>
</thead>
<tbody id="detailsstockid">
<tr ng-repeat="course in courseData">
<td>{{ }}</td>
<td>{{course.course_name}}</td>
<td>{{course.short_name}}</td>
<td >{{course.semester}}</td>
<td>
<a href='/course?e_i={{course.course_id}}' >
<input type='button' class='btn btn-xs btn-green' value='Edit' >
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
In serial no column i will add the numbers serially which will increment each addition of database value.Please help me.
Upvotes: 2
Views: 2557
Reputation: 4803
$index will give you the index of the item in the current table. But that is not tied to your db, only to the current table row #
<td>{{$index }}</td>
Upvotes: 4