2

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.

3
  • if i will add {{$index}} it will work properly ?
    – satya
    Commented Sep 29, 2015 at 6:48
  • yes, it'll bind $index on each of the elements.
    – Shrinath
    Commented Sep 29, 2015 at 6:50
  • welcome @satya ..If my answer helpful to you , you can raise a flag. Happy coding !!
    – Shrinath
    Commented Sep 29, 2015 at 6:56

1 Answer 1

4

$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>
1
  • @ Enkode : Yes,Thanks
    – satya
    Commented Sep 29, 2015 at 6:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.