学习angularjs时遇到 XX is not a function

 

 

第一次练习就直接没效果:

 

"后不能直接以 function XXXcontroller (){ code......}这样的方式直接注册监听器了。

以后必须angular.module('phonecatApp', []).controller('PhoneListCtrl',function($scope) {}这样来将controller注册到对应的模型上。"

 

以下是标准的:

  1. <script type="text/javascript">
  2.         angular.module('phonecatApp', []).controller('PhoneListCtrl', function ($scope) {
  3.             $scope.phones = [
  4.          {
  5.              "name": "Nexus S",
  6.              "snippet": "Fast just got faster with Nexus S."
  7.          },
  8.          {
  9.              "name": "Motorola XOOM? with Wi-Fi",
  10.              "snippet": "The Next, Next Generation tablet."
  11.          },
  12.          {
  13.              "name": "MOTOROLA XOOM?",
  14.              "snippet": "The Next, Next Generation tablet."
  15.          }
  16.             ];
  17.         });
  18.  
  19.     </script>

 

国内中文博客还不更新,情何以堪。。。。

另外,Angularjs文档被墙在外面了。。

 

参考:

http://jingyan.baidu.com/article/eae07827ae12b91fec548597.html

posted @ 2015-10-08 17:26  _DN  阅读(989)  评论(0编辑  收藏  举报