Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Angular.js中使用分页时增加序列号_Javascript_Angularjs_Pagination - Fatal编程技术网

Javascript 如何在Angular.js中使用分页时增加序列号

Javascript 如何在Angular.js中使用分页时增加序列号,javascript,angularjs,pagination,Javascript,Angularjs,Pagination,我需要一个帮助。我正在使用Angular.jsdirPagination.js对我的表数据进行分页,但这里我的问题是假设我每页的固定项是5,前5项带有序列号1,2,3,4,5,但对于第二页,序列号又是从1开始的。我在下面添加我的代码 <tr dir-paginate="pro in ($parent.labelResults=(productDataList | filter:searchProduct)) | itemsPerPage:5" current-page="currentP

我需要一个帮助。我正在使用Angular.js
dirPagination.js
对我的表数据进行分页,但这里我的问题是假设我每页的固定项是5,前5项带有序列号
1,2,3,4,5
,但对于第二页,序列号又是从1开始的。我在下面添加我的代码

<tr dir-paginate="pro in ($parent.labelResults=(productDataList  | filter:searchProduct)) | itemsPerPage:5" current-page="currentPage">
<td>{{itemsPerPage *(currentPage-1)+$index+1}}</td>
<td>{{pro.Product_name}}</td>
<td><img ng-src="upload/{{pro.image}}" name="pro" border="0" style="width:50px; height:50px; border:#808080 1px solid;" /></td>
<td>{{pro.Discount}}</td>
<td>{{pro.Offer}}</td>
<td>{{pro.unit_cost_price}}</td>
<td>{{pro.unit_sale_price}}</td>
<td>{{pro.quantity}}</td>
<td>{{pro.shipping_charge}}</td>                                                  
</tr>   
<div class="pull-right">
<dir-pagination-controls  max-size="5"  direction-links="true"  boundary-links="true" >
 </dir-pagination-controls>
</div>

{{itemsPerPage*(当前页面-1)+$index+1}}
{{pro.Product_name}}
{{专业折扣}}
{{pro.Offer}}
{{专业单位成本价格}
{{专业单位销售价格}
{{pro.quantity}}
{{专业运费}
在这里,对于分页的每一页,序列号从1开始。在这里,我需要从第一页开始,序列号应该从1开始,并且应该像
1,2,3….
一样继续。请帮助我解决此问题

可以使用
(每页项目*(当前页面1))+$index+1来实现


样本

还要考虑页码…@RayonDabre:不明白。你能给出任何解决方案吗?如果我理解正确,如果每页有5个项目,总共10个项目,你希望下一页有
6,7,8..
,对吗?可以使用
(每页项目*(当前第1页))+$index+1
我将在哪里写这篇文章。你能用我的代码编辑你的答案吗?谢谢你的回答。我尝试了很多方法,但只有你的解决方案有效。它帮助我显示自定义分页
<tr dir-paginate="pro in users | itemsPerPage:itemsPerPage" current-page="currentPage"> 
<td>{{itemsPerPage *(currentPage-1)+$index+1}}</td> 
<td>{{pro.first_name}}</td> 
<td>{{pro.last_name}}</td> 
<td>{{pro.hobby}}</td> 
</tr>
$scope.currentPage=1;
$scope.itemsPerPage=5;