控制器不是函数,而是未定义的,同时全局定义控制器。
错误:[Ng:areq] http:/errors.angularjs.org/1.3.0-beta.17/ng/areq?p0=ContactController&p1=Not%20a%20 function%2C%20 get%20未定义
参数‘ContactController’不是函数,未定义
<!DOCTYPE html><html ng-app><head> <script src="../angular.min.js"></script> <script type="text/javascript"> function ContactController($scope) { $scope.contacts = ["abcd@gmail.com", "abcd@yahoo.co.in"]; $scope.add = function() { $scope.contacts.push($scope.newcontact); $scope.newcontact = ""; }; } </script> </head><body> <h1> modules sample </h1> <div ng-controller="ContactController"> Email:<input type="text" ng-model="newcontact"> <button ng-click="add()">Add</button> <h2> Contacts </h2> <ul> <li ng-repeat="contact in contacts"> {{contact}} </li> </ul> </div></body> </html>
慕的地6264312
幕布斯6054654
慕运维8079593
相关分类