angular.js多个控制器提示错误Error: [ng:areq]的解决方法
2017-02-15 10:52
796 查看
今天玩angular.js,在一个module下写了多个控制器,遇到这样一个问题,如图:
![](https://oscdn.geek-share.com/Uploads/Images/Content/201908/20/e5a024f2a5948666ff01002ed24b335c)
刚开始我以为是angular.js版本问题,换了低版本的1.2后还是会报这样的错误,所以我就改写了angular控制器的写法,如下:
app.controller('myCtrl',["$scope",function($scope){ //Angular.js控制器
$scope.firstName="zhao";
$scope.lastName="yongwei";
console.log($scope);
}]);
app.controller('myCtrl1',["$scope",function($scope){ //Angular.js控制器
$scope.firstName="lu";
$scope.lastName="hongxia";
}]);
问题解决!
刚开始我以为是angular.js版本问题,换了低版本的1.2后还是会报这样的错误,所以我就改写了angular控制器的写法,如下:
app.controller('myCtrl',["$scope",function($scope){ //Angular.js控制器
$scope.firstName="zhao";
$scope.lastName="yongwei";
console.log($scope);
}]);
app.controller('myCtrl1',["$scope",function($scope){ //Angular.js控制器
$scope.firstName="lu";
$scope.lastName="hongxia";
}]);
问题解决!
相关文章推荐
- 项目常见错误及解决方法-angular提示控制器未注册
- nginx提示:500 Internal Server Error错误的解决方法
- 解决IIS7中出现An error occurred on the server when processing the URL错误提示的方法
- ThinkPHP提示错误Fatal error: Allowed memory size的解决方法
- Xcode 4.3.2 (4E2002)错误提示Storyboards are unavailable on iOS 4.3 and prior的解决方法
- dede织梦上传图片出现提示302错误ERROR解决方法
- [Asp]解决IIS7中出现An error occurred on the server when processing the URL错误提示的方法
- 错误: [ng:areq] http://errors.angularjs.org/1.3.0-rc.2/ng/areq?p0=HelloWorldCtrl&p1=not a function
- nginx提示:500 Internal Server Error错误的解决方法
- 腾讯信鸽推送"CURL ERROR:name lookup timed out"错误提示解决方法
- IE8提示JS错误(KB927917)终极解决方法
- 解决编译器“The connection to adb is down, and a severe error has occured.ADB server didn't ACK”提示错误方法
- mx:states包含mx:AddChild 在切换时提示错误"TypeError: Error #1009: 无法访问空对象引用的属性或方法"的解决方法
- 解决IIS7中出现An error occurred on the server when processing the URL错误提示的方法
- 安装MYSQL时最后一步提示could not start the servers mysql.error:0错误解决方法
- 编译mysql提示错误:configure: error: No curses/termcap library found 解决方法
- 解决IIS7中出现An error occurred on the server when processing the URL错误提示的方法
- ThinkPHP提示错误Fatal error: Allowed memory size的解决方法
- 编辑 XSD 文件时错误提示 components from this namespace are not referenceable from schema document 解决方法