angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?

1、错误描述

[html]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  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  
  2.     at Error (native)  
  3.     at http://127.0.0.1:8020/AngularJS/js/angular.min.js:6:412  
  4.     at sb (http://127.0.0.1:8020/AngularJS/js/angular.min.js:23:18)  
  5.     at Pa (http://127.0.0.1:8020/AngularJS/js/angular.min.js:23:105)  
  6.     at http://127.0.0.1:8020/AngularJS/js/angular.min.js:89:310  
  7.     at ag (http://127.0.0.1:8020/AngularJS/js/angular.min.js:72:419)  
  8.     at p (http://127.0.0.1:8020/AngularJS/js/angular.min.js:64:262)  
  9.     at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:481)  
  10.     at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:498)  
  11.     at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:498)  


2、错误原因

[html]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. <!DOCTYPE html>  
  2. <html ng-app>  
  3.     <head>  
  4.         <meta charset="UTF-8">  
  5.         <title></title>  
  6.         <script type="text/javascript" src="../js/angular.min.js" ></script>  
  7.     </head>  
  8.     <body>  
  9.         <div ng-controller="username">  
  10.             <input type="text" id="inp" ng-model="user.name">  
  11.             <div>{{user.name}}</div>  
  12.         </div>  
  13.         <script>  
  14.             function username($scope)  
  15.             {  
  16.                 $scope.user = {name:"杰西卡"};  
  17.             }  
  18.         </script>  
  19.     </body>  
  20. </html>  


3、解决办法

[html]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. <!DOCTYPE html>  
  2. <html ng-app="userApp">  
  3.     <head>  
  4.         <meta charset="UTF-8">  
  5.         <title></title>  
  6.         <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>  
  7.         <script>  
  8.             var app = angular.module("userApp",[]);  
  9.             app.controller("username",function($scope){  
  10.                 $scope.user = {name:"杰西卡"}  
  11.             });  
  12.         </script>  
  13.     </head>  
  14.     <body>  
  15.         <div ng-controller="username">    
  16.             <input type="text" id="inp" ng-model="user.name">    
  17.             <div>{{user.name}}</div>    
  18.         </div>    
  19.     </body>  
  20. </html>  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值