最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
AngularJS表格添加序号的方法
时间:2017-05-18 编辑:简简单单 来源:一聚教程网
1、问题背景
AngularJS表格需要序号,可以利用$index来作为序号
2、实现实例
代码如下 | 复制代码 | ||||||||
table,th,td{ border-collapse: collapse; } table tr:nth-child(even){ background-color:#F7E1B5; } table tr:nth-child(odd){ background-color:#F1F1F1; }
varapp = angular.module("tableStyleApp",[]); app.controller("tableStyleController",function($scope){ $scope.datas = [ {no:"2016010101",name:"张思",age:"23"}, {no:"2016010102",name:"赵虎",age:"22"}, {no:"2016010103",name:"李磊",age:"24"}, {no:"2016010104",name:"孙雪",age:"21"}, {no:"2016010105",name:"郝蕾",age:"20"}, {no:"2016010106",name:"朱峰",age:"25"}, {no:"2016010107",name:"升力",age:"22"}, {no:"2016010108",name:"刘华",age:"24"}, {no:"2016010109",name:"京兆",age:"20"}, {no:"2016010110",name:"张峰",age:"22"} ] });
|
3、实现结果
-
上一个: JS实现双击内容变为可编辑状态
相关文章
- AngularJS监听路由变化的方法 06-02
- 利用angularjs1.4制作的简易滑动门效果 05-10
- AngularJS执行流程详解 04-14
- AngularJS 使用ng-repeat报错 [ngRepeat:dupes] 02-08
- AngularJS入门教程:Helloworld 12-26
- AngularJS如何通过ng-route实现基本路由功能的教程 12-14