简体   繁体   中英

Add serial number in the table using angular.js

i have a table which contains the database values but here i need to add serial no( ie-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.

$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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM