angular 入门调试遇到的问题

[size=x-large]1.[$injector:modulerr] Failed to instantiate module ngRoute due to:[/size]
[img]http://dl2.iteye.com/upload/attachment/0111/4104/28dacf15-aa1b-30c2-8ea7-380d9ea263b0.png[/img]

//angular-rounte.js错误or缺少
<script src="mylib/angular.js"></script>
<script src="mylib/angular-routee.js"></script>


[size=x-large]2.Error: [ng:areq] Argument 'xxxController' is not a function, got undefined[/size]

[img]http://dl2.iteye.com/upload/attachment/0111/4113/0cc4c41a-0d8c-37f6-9ea3-cd24b06f459a.png[/img]


//参考书上都是这样,应该是改版了,有知道的同学回复下,为什么这样?
function StartUpController($scope) {
$scope.computeNeeded = function() {
$scope.needed = $scope.startingEstimate * 10;
};
$scope.requestFunding = function() {
window.alert("Sorry, please get more customers first.");
};
}


//应该这样写
angular.module("a",[]).controller("StartUpController",function($scope){
$scope.computeNeeded = function() {
$scope.needed = $scope.startingEstimate * 10;
};
$scope.requestFunding = function() {
window.alert("Sorry, please get more customers first.");
};
})


[size=x-large]3.angular 官方js下载[/size]
//哎,百度我老是去找联网的引入方式。还是本地下下来玩吧,卸载不了,请留言
[url]http://cdn.angularjs.cn/angularjs/angularjs-latest.zip[/url]


[size=x-large]4.[$injector:nomod] Module 'myApp' is not available![/size]

[img]http://dl2.iteye.com/upload/attachment/0111/4305/12e8d086-abe9-3b96-ae1f-3d173f6ad675.png[/img]

script 导入文件错误,没找到ctrl.js


[size=x-large]5.Error: xxxis not defined[/size]

[img]http://dl2.iteye.com/upload/attachment/0111/4310/35c3f934-ce9d-361b-9af2-09fa5fa4e015.png[/img]


angular.module("myApp",[])
.value('realname','vlaue声明')
.constant('http', '常量constant声明')
.value('realname','vlaue声明,可以改变')
.constant('http', '常量constant声明,永远不可改变')

//自己定义的参数不要溜掉
//另外constant不可以改变数值
.controller('valueCtrl', function($scope,realname,http){
$scope.msg = "hello valueCtrl";
$scope.realname = realname;
$scope.http = http;
})


[size=x-large]6.Uncaught Error: [$injector:nomod] Module 'niuApp.bank' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.[/size]

[img]http://dl2.iteye.com/upload/attachment/0112/0077/6ff4ff54-9eeb-383c-81c8-038c584ddf68.png[/img]

引入js文件的地方,确保js文件名字正确,和js文件的顺序,被坑大了



[size=x-large]7.$browser.addPollFn is not a function[/size]
angular-cookies.js文件版本错误,确保js版本一致,最好1.4以上
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值