1、错误描述
angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?p0=username&p1=not%20a%20function%2C%20got%20undefined at Error (native) at http://127.0.0.1:8020/AngularJS/js/angular.min.js:6:412 at sb (http://127.0.0.1:8020/AngularJS/js/angular.min.js:23:18) at Pa (http://127.0.0.1:8020/AngularJS/js/angular.min.js:23:105) at http://127.0.0.1:8020/AngularJS/js/angular.min.js:89:310 at ag (http://127.0.0.1:8020/AngularJS/js/angular.min.js:72:419) at p (http://127.0.0.1:8020/AngularJS/js/angular.min.js:64:262) at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:481) at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:498) at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:498)
<!DOCTYPE html> <html ng-app> <head> <Meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/angular.min.js" ></script> </head> <body> <div ng-controller="username"> <input type="text" id="inp" ng-model="user.name"> <div>{{user.name}}</div> </div> <script> function username($scope) { $scope.user = {name:"张丝丝"}; } </script> </body> </html>
3、解决办法
原文链接:https://www.f2er.com/angularjs/149071.html