zoukankan      html  css  js  c++  java
  • 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"
            }
        ]
    } -->
  • 相关阅读:
    CSS中常用中文字体转Unicode编码表
    CSS自定义字体(@font-face选择符)
    ie7 动态改变select option时,宽度自动变短解决方法
    面试题
    HTML DOM Document 对象
    测试
    复习代码
    Android 极光推送集成
    Android 事件分发
    Android View
  • 原文地址:https://www.cnblogs.com/zgqdbxb/p/9501219.html
Copyright © 2011-2022 走看看