zoukankan      html  css  js  c++  java
  • AngularJS继续中

    <html ng-app>//全局中引用对应于PhoneListCtrl 模板
    
    <head>
        <script src="js/angular.js"></script>
        <script src="js/test.js"></script>
    </head>
    
    <body ng-controller="PhoneListCtrl">
    
    
        <ul>
            <li ng-repeat="pho in phones">
                {{pho.name}}
                <p>{{pho.snippet}}</p>
            </li>
        </ul>
    
    //div里面的作用域 myapp <div ng-app="myapp" ng-controller="mytest"> <ul> <li ng-repeat="ph in phone"> {{ph.name}} <p>{{ph.snippet}}</p> </li> </ul> </div> </body> </html>

    js 代码

    function PhoneListCtrl($scope) {
        $scope.phones = [
          {
              "name": "Nexus S",
              "snippet": "Fast just got faster with Nexus S."
          },
          {
              "name": "Motorola XOOM™ with Wi-Fi",
              "snippet": "The Next, Next Generation tablet."
          },
          {
              "name": "MOTOROLA XOOM™",
              "snippet": "The Next, Next Generation tablet."
          }
        ];
    }
    
    
    //自己声明模板 共外部使用
    var app = angular.module('myapp', []);
    app.controller('mytest', function ($scope) {
        $scope.phone = [
           {
               "name": "Nexus S",
               "snippet": "Fast just got faster with Nexus S."
           },
           {
               "name": "Motorola XOOM™ with Wi-Fi",
               "snippet": "The Next, Next Generation tablet."
           },
           {
               "name": "MOTOROLA XOOM™",
               "snippet": "The Next, Next Generation tablet."
           }
        ];
    });

    http://www.widuu.com/archives/04/1035.html

    http://www.ituring.com.cn/article/15762

    尚未顿悟

  • 相关阅读:
    c++ cout、cin、endl
    c++ namespace
    找到小镇的法官
    整数反转
    c++stack类的用法
    栈应用:最小栈(第二题)
    栈的压入、弹出序列(第一题)
    c++中vector类的用法
    Android 面试常问七道题
    传感器实现仿微信摇一摇功能
  • 原文地址:https://www.cnblogs.com/yujian-bcq/p/3831913.html
Copyright © 2011-2022 走看看