简体   繁体   English

使用angular.js在表中添加序列号

[英]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. 我有一个包含数据库值的表,但在这里我需要使用angular.js.i在此表中添加序列号( ie-1,2,3,4..... ),并在下面解释我的代码。

course.html: 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. $ index将为您提供当前表中项目的索引。 But that is not tied to your db, only to the current table row # 但这与您的数据库无关,只与当前表行#相关联

<td>{{$index }}</td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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