• anngular ng-repeat循环


    <html ng-app="myApp">
    <head>
    <title>angularjs-demo</title>
    <link href="bootstrap.min.css" rel="stylesheet">
    <link href="index.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/angular.js/1.6.4/angular.js"></script>
    </head>
    <body ng-controller="ctrl">
     <div class="table-responsive">
                <table class="table table-striped table-sm">
                  <tbody>
                    <thead>
                    <tr>
                      <th>课程</th>
                      <th>网址</th>
                      <th>学籍</th>
                     
                    </tr>
                  </thead>
                    <tr ng-repeat="item in items">
                      <td>{{item.Name}}</td>
                      <td>{{item.Url}}</td>
                      <td>{{item.Country}}</td>
                     
                    </tr>
                    <tr>
                      <td>1,002</td>
                      <td>amet</td>
                      <td>consectetur</td>
                    </tr>
                    
                  </tbody>
                </table>
              </div>
            </main>
          </div>
        </div>
    <script>
        var app = angular.module('myApp',[]);
        app.controller("ctrl",function($scope,$location){
            $scope.items = getStu();
        });
        
        function getStu() {
            return [ {
                "Name": "菜鸟教程",
                "Url": "www.runoob.com",
                "Country": "CN"
            },
            {
                "Name": "Google",
                "Url": "www.google.com",
                "Country": "USA"
            },
            {
                "Name": "Facebook",
                "Url": "www.facebook.com",
                "Country": "USA"
            },
            {
                "Name": "微博",
                "Url": "www.weibo.com",
                "Country": "CN"
            }];
        }
        </script>
    </body>
    </html>
    <!--  {
        "sites": [
            {
                "Name": "菜鸟教程",
                "Url": "www.runoob.com",
                "Country": "CN"
            },
            {
                "Name": "Google",
                "Url": "www.google.com",
                "Country": "USA"
            },
            {
                "Name": "Facebook",
                "Url": "www.facebook.com",
                "Country": "USA"
            },
            {
                "Name": "微博",
                "Url": "www.weibo.com",
                "Country": "CN"
            }
        ]
    } -->
  • 相关阅读:
    《设计模式》(精华集)
    TClientDataSet使用(二)
    害我查了半天的错误!av错误,小心Component对象使用Application当Owner
    释放自己
    最近在转C#
    TClientDataSet的使用技巧
    小心使用可修改的常量。
    指数函数和正弦函数相乘
    adb 常用命令
    win7下ie9设置无法保存的问题
  • 原文地址:https://www.cnblogs.com/zgqdbxb/p/9501219.html
Copyright © 2020-2023  润新知