zoukankan      html  css  js  c++  java
  • angular.js写法不规范导致错误

    以下写法:没有明确指定module和controller,写法不规范. 更改angular.js版本会出bug.

     1 <html ng-app>
     2 <head>
     3     <title>1.0.1-1.5版本间的差异</title>
     4     <script src="/js/angular-1.0.1.min.js"></script> <!--可以正常显示-->
     5     <!--<script src="/js/angular.min.js"></script>  1.5版本 显示不了-->
     6     <script>
     7         
     8         /* phones.js
     9             [
    10             {
    11                 "name": "Nexus S",
    12                 "snippet": "Fast just got faster with Nexus S.",
    13                 "age": 0,
    14                 "imageUrl": "/img/01.png",
    15                 "id":1
    16             },
    17             {
    18                 "name": "Motorola XOOM™ with Wi-Fi",
    19                 "snippet": "The Next, Next Generation tablet.",
    20                 "age": 1,
    21                 "imageUrl": "/img/02.png",
    22                 "id": 2
    23             },
    24             {
    25                 "name": "MOTOROLA XOOM™",
    26                 "snippet": "The Next, Next Generation tablet.",
    27                 "age": 2,
    28                 "imageUrl": "/img/03.png",
    29                 "id": 3
    30             }
    31         ]
    32         */
    33         function PhoneListCtrl($scope, $http) {
    34             $http.get('/html/angular/json/phones.js').success(function (data) {
    35                 $scope.phones = data;
    36             });
    37         }
    38     </script>
    39     <link href="/js/bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet" />
    40 </head>
    41 <body >
    42     <div class="container-fluid">
    43         <div class="row" ng-controller="PhoneListCtrl">
    44 
    45             <ul>
    46                 <li ng-repeat="phone in phones">
    47                     <a href="#{{phone.id}}">{{phone.name}}</a>
    48                     <p>{{phone.snippet}}</p>
    49                 </li>
    50             </ul>
    51 
    52 
    53         </div>
    54     </div>
    55 </body>
    56 </html>

    附学习地址:

    a.angularJS中文社区

    b.angularJS官网

    下篇:写个规范的...

  • 相关阅读:
    noip2011 总结
    noip2010 总结
    noip2009 总结
    noip2008 总结
    noip2006总结
    noip2007 总结
    noip2006 总结
    【模板】线段树模板
    【数学】8.30题解-count数页码
    【数论】8.30题解-prime素数密度 洛谷p1835
  • 原文地址:https://www.cnblogs.com/ICE_Inspire/p/5208064.html
Copyright © 2011-2022 走看看