最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

AngularJS表格添加序號(hào)的方法

 更新時(shí)間:2017年03月03日 10:17:42   作者:翱翔天地  
這篇文章主要介紹了AngularJS表格添加序號(hào)的方法,涉及AngularJS表格的遍歷及序號(hào)添加實(shí)現(xiàn)技巧,需要的朋友可以參考下

本文實(shí)例講述了AngularJS表格添加序號(hào)的方法。分享給大家供大家參考,具體如下:

1、問(wèn)題背景

AngularJS表格需要序號(hào),可以利用$index來(lái)作為序號(hào)

2、實(shí)現(xiàn)實(shí)例

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>AngularJS之表格序號(hào)</title>
    <link rel="stylesheet" href="css/bootstrap.css" rel="external nofollow" />
    <script src="angular.js/1.4.6/angular.min.js"></script>
    <style>
      table,th,td{
        border-collapse: collapse;
      }
      table tr:nth-child(even){
        background-color: #F7E1B5;
      }
      table tr:nth-child(odd){
        background-color: #F1F1F1;
      }
    </style>
    <script>
      var app = 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"}
        ]
      });
    </script>
  </head>
  <body>
    <div ng-app="tableStyleApp" ng-controller="tableStyleController">
      <table class="table table-bordered table-condensed">
        <thead>
          <tr>
            <th>序號(hào)</th>
            <th>學(xué)號(hào)</th>
            <th>姓名</th>
            <th>年齡</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="data in datas">
            <td>{{$index+1}}</td>
            <td>{{data.no}}</td>
            <td>{{data.name}}</td>
            <td>{{data.age}}</td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>

3、實(shí)現(xiàn)結(jié)果

更多關(guān)于AngularJS相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《AngularJS指令操作技巧總結(jié)》、《AngularJS入門(mén)與進(jìn)階教程》及《AngularJS MVC架構(gòu)總結(jié)

希望本文所述對(duì)大家AngularJS程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

宁明县| 保德县| 吐鲁番市| 哈巴河县| 滕州市| 隆林| 绍兴县| 亚东县| 南皮县| 松江区| 黎川县| 徐闻县| 永平县| 贺兰县| 红桥区| 柏乡县| 山丹县| 桐柏县| 准格尔旗| 霍州市| 西和县| 涟源市| 太湖县| 临江市| 当雄县| 东阿县| 依兰县| 西和县| 连城县| 梨树县| 天水市| 安塞县| 岑巩县| 桂东县| 阳曲县| 凤冈县| 巴林左旗| 思南县| 乌拉特中旗| 南陵县| 临夏县|