用angularjs 模块时Error: [ng:areq] Argument 'controller' is not a function,
来源:互联网 发布:氟硝西泮片淘宝店 编辑:程序博客网 时间:2024/05/01 07:32
今天学习angular时,发生了这个错误,网上大多数是说,不能直接用function写controller了,要用module,但我就是用的module啊代码如下:
解决办法:既然用模块了,<html ng-app>就不行了,改成 <html> bingo!!
js :var mainApp = angular.module("mainApp",[]);mainApp.controller("controller",function($scope){$scope.student={firstName:"hepenghui",fees:400,fullName: function(){return "hello bitch";}};});
html :<!doctype html><html ng-app> <head> <script src="angular.js"></script> <script src="controller.js"></script> </head> <body> Your name: <input type="text" ng-model="yourname" placeholder="World"> <hr/> Hello {{yourname || 'World'}}! <hr/> 1+2={{1+2}} <hr/> <span>dianjicishu : {{count}}</span> <input type="button" value="点击次数" ng-click="count=count+1"/> <hr/> <textarea rows="" cols="50">ng-show ng-hide ng-disabled ng-click </textarea> <hr/> <div ng-app="mainApp" ng-controller="controller"> <input type="text" ng-model="student.firstName"></input> <span>{{ student.fullName() }}</span> </div> </body></html>
解决办法:既然用模块了,<html ng-app>就不行了,改成 <html> bingo!!
0 0
- 用angularjs 模块时Error: [ng:areq] Argument 'controller' is not a function,
- 【AngularJs】---Error: [ng:areq] Argument is not a function, got undefined;
- AngularJS Error: [ng:areq] loginController is not a function
- AngularJS--[ng:areq] Argument 'xxCtrl' is not a function, got undefined!错误
- Error: [ng:areq] http://errors.AngularJS.org/1.5.8/ng/areq?p0=HelloCtrl&p1=not%20a%20function%2C%20g
- 错误: [ng:areq] http://errors.angularjs.org/1.3.0-rc.2/ng/areq?p0=HelloWorldCtrl&p1=not a function
- [AngularJS]Argument 'xxxx' is not a function, got undefined
- AngularJs出现错误Error: [ng:areq]
- AngularJS Argument 'customersController' is not a function, got undefined,errors.angularjs.org/1.3.1
- angularJS1 报错 Error: [ng:areq] Error: [$controller:ctrlreg]
- Angularjs 报错 Argument 'MyController' is not a function, got undefined
- angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?
- angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?
- Error: [ng:areq]
- Error: [ng:areq] http://errors.angularjs.org...undefined
- 学习angularjs时遇到 XX is not a function
- Javascript Error: submit is not a function
- .substring error: “is not a function”
- JAVA操作properties文件
- 使用Gradle打Android渠道包
- Stanford机器学习---第一讲. Linear Regression with one variable
- Hello Java!
- 遇见C++ Lambda
- 用angularjs 模块时Error: [ng:areq] Argument 'controller' is not a function,
- 用友ERT T6 技术解析(二) --WCF发布
- Navicat Premium下sql导入中文乱码解决方案
- 学习jQuery EasyUI知识点(1)
- GetLastError函数使用及返回代码对照
- 【笔记】JunitTest的运行流程
- Android开发教程--关于onActivityResult没有回调的问题
- ObjectC 类的一些问题解析
- 对C++运算符重载的作业分析