Microsoft JScript 运行时错误:AngularJS v1.3.0-beta.11 中的 [$injector:modulerr] [英] Microsoft JScript runtime error: [$injector:modulerr] in AngularJS v1.3.0-beta.11
本文介绍了Microsoft JScript 运行时错误:AngularJS v1.3.0-beta.11 中的 [$injector:modulerr]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了
Microsoft JScript runtime error: [$injector:modulerr] http://errors.angularjs.org/1.3.0-beta.11/$injector/modulerr?p0=MyApp&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.3.0-beta.11%2F%24injector%2Fnomod%3Fp0%3DMyApp
我怎样才能解决这个问题?我正在使用最新版本的 AngularJS
,即 AngularJS v1.3.0-beta.11
.
How can I possibly fix this issue? I am using the latest version of AngularJS
which is AngularJS v1.3.0-beta.11
.
这是我的index.htm
代码:
<!DOCTYPE html>
<html lang="en" ng-app="MyMVC">
<head>
<meta http-equiv="x-ua-compatible" content="IE=9" charset="UTF-8"/>
<title></title>
<script src="lib/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="JSON3.min.js" type="text/javascript"></script>
<script src="lib/angular/angular.min.js" type="text/javascript"></script>
<script src="lib/angular/angular-route.min.js" type="text/javascript"></script>
<script src="lib/angular/app.js" type="text/javascript"></script>
<script src="lib/angular/controllers.js" type="text/javascript"></script>
</head>
<body>
<div ng-view></div>
这是我的app.js
代码
var myApp = angular.module('MyMVC', [
'ngRoute',
'logController'
]);
myApp.config(['$routeProvider', function($routeProvider)]{
$routeProvider.
when('/list', {
templateUrl: 'partials/list.htm',
controller: 'ListController'
}).
otherwise({
redirectTo: '/list'
});
});
这是我的 controller.js
代码:
var logController = angular.module('logController', []);
logController.controller('ListController', function ($scope, $http) {
$http.post('testws.asmx/GetLogs', {
headers: { 'Content-Type': 'application/json; charset=utf-8' }
}).success(function (data) {
$scope.logs = data.d;
$scope.orderRecord = 'RecordId';
})
.error(function (err) {
$scope.error = err["Message"];
});
});
任何建议都会有很大帮助.谢谢!
Any suggestions will be a big help. Thanks!
更新:将 angular js 缩小版本更改为 not这是新的错误提示:
UPDATE: change angular js minified version to not Here is the new error prompt:
Microsoft JScript runtime error: [$injector:modulerr] Failed to instantiate module MyMVC due to:
[$injector:nomod] Module 'MyMVC' 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.
http://errors.angularjs.org/1.3.0-beta.11/$injector/nomod?p0=MyMVC
http://errors.angularjs.org/1.3.0-beta.11/$injector/modulerr?p0=MyMVC&p1=%5B%24injector%3Anomod%5D%20Module%20'MyMVC'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.3.0-beta.11%2F%24injector%2Fnomod%3Fp0%3DMyMVC
推荐答案
myApp.config(['$routeProvider', function($routeProvider){
$routeProvider.
when('/list', {
templateUrl: 'partials/list.html',
controller: 'ListController'
}).
otherwise({
redirectTo: '/list'
});
}]);
解决问题,我只是放错了 ]
并将其移到最后.感谢所有帮助:-)
solve the issue, i just misplaced the ]
and move it to the end. Thanks for all the help :-)
这篇关于Microsoft JScript 运行时错误:AngularJS v1.3.0-beta.11 中的 [$injector:modulerr]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文