错误:$injector:modulerr模块错误(我的第一个SPA应用程序)
Error: $injector:modulerr Module Error (my first SPA app)
我第一次在Angular中编写SPA应用程序,但遇到了一个问题。
我创建路由的JavaScript如下所示:
$(function() {
angular.module("myApp", ["ngRoute"])
.config(function($routeProvider) {
$routeProvider.otherwise({
templateUrl: "/angular/components/booking-system/booking-system-template.html"
});
});
});
我的"主页"(正确的术语是什么?)看起来是这样的:
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My App</title>
<script src="/Scripts/jquery-1.10.2.min.js"></script>
<script src="/Scripts/angular.min.js"></script>
<script src="/Scripts/angular-route.min.js"></script>
<script src="/angular/scripts/route-config.js"></script>
<link href="/Content/bootstrap.min.css" rel="stylesheet" />
<link href="/Content/bootstrap-select.css" rel="stylesheet" />
</head>
<body>
<div class="container body-content">
<ng-view/>
</div>
</body>
</html>
我得到以下错误:
Failed to instantiate module myApp due to:
Error: [$injector:nomod] http://errors.angularjs.org/1.3.13/$injector/nomod?p0=ibo...
at Error (native)
at http://localhost:4685/Scripts/angular.min.js:6:417
at http://localhost:4685/Scripts/angular.min.js:21:412
at a (http://localhost:4685/Scripts/angular.min.js:21:53)
at http://localhost:4685/Scripts/angular.min.js:21:296
at http://localhost:4685/Scripts/angular.min.js:35:116
at s (http://localhost:4685/Scripts/angular.min.js:7:302)
at g (http://localhost:4685/Scripts/angular.min.js:34:399)
at ab (http://localhost:4685/Scripts/angular.min.js:38:135)
at d (http://localhost:4685/Scripts/angular.min.js:17:381
我做错了什么?请帮忙!
M
由于$
符号的原因,您的自执行块似乎有问题。请更改下面的代码,然后尝试,
(function(){
angular.module("myApp", ["ngRoute"])
.config(function($routeProvider) {
$routeProvider.otherwise({
templateUrl: "/angular/components/booking-system/booking-system-template.html"
});
});
}());
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- Jquery菜单操作不稳定,定位不正确,存在一般错误
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 我如何修复包含在captcha的addthis中的错误
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 节点是否需要模块传递带有方括号的arg?这是个错误吗
- Webpack/Rect:遵循egghead.io教程,但出现错误:您可能需要一个合适的加载程序来处理此文件类型
- CKFinder 3为所选文件返回错误的URL
- 同位素库错误:未捕获错误无布局模式包装生产线8
- 铬:“;未捕获的语法错误:意外的标记:"
- 如何通过自己获得Chrome扩展的用户反馈/错误报告
- 相位器状态未捕获参考错误
- /undefined在我的404错误日志中多次出现
- 错误:$injector:modulerr模块错误(我的第一个SPA应用程序)
- 错误:无法在“XMLHttpRequest”上执行“发送”:无法加载“文件”:AngularJS SPA
- 谷歌的验证码在我的SPA中成功验证后给出“未捕获的安全错误”
- 当使用IE兼容模式与剑道UI SPA应用程序时,NodeFilter是未定义的错误
- 如何在大型SPA中处理和记录Javascript中的错误