- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
可能是重复的( Failed to instantiate module error in Angular js ),但给定的措施(包括 HTML 中的 ng-route 并没有解决问题)。
这是错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module coursemate due to: Error: [$injector:nomod] Module 'coursemate' 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.
这是我的 app.js
var coursemate = angular.module('coursemate', ["ngRoute"]);
coursemate.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl : "view1.html"
})
.otherwise({
redirectTo : '/'
});
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
这是我的index.html
<!DOCTYPE html>
<html lang="de" ng-app="coursemate">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>CourseMate</title>
<base href="/CourseMate/" />
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="css/mdb.min.css" rel="stylesheet">
<!-- Your custom styles (optional) -->
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<ng-view>
</ng-view>
</body>
<!-- SCRIPTS -->
<!-- JQuery -->
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/tether.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
<!-- AngularJS reditect -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.js"></script>-->
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script src="/app.js"></script>
</html>
我找不到我的错误,因为我认为我没有以错误的方式初始化应用程序?
最佳答案
删除redirectTo: '/'后的“;”。并确保您的 CourseMate 目录中包含所有引用资料。
关于javascript - AngularJs错误: [$injector:modulerr] by ngRoute?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44033729/
我正在尝试创建一个带有 Angular 路由的 SPA(单页应用程序),但是当我将 ndRoute 添加到我的模块时,它给了我这个错误 Uncaught Error: [$injector:modul
我使用环回作为后端,使用 postgresql 作为数据库。所以我尝试使用 lb-service/js。 如果我尝试在 login.js 中包含 lbServices (angular.module(
我正在尝试将表情符号应用程序注入(inject)我的项目。 我添加了emoji.min.js并像这样引用它 现在我也将它注入(inject)到我的项目中,如下所示: angular.module('
我正在使用 anguarjs 开发一个应用程序,并出现如下错误: 无法实例化模块 myApp,原因是:错误:[$injector:modulerr] http://errors.angularjs.o
var demoapp = angular.module('demoapp', []); demoapp.controller('SimpleC
我正在尝试通过网络摄像头简单地读取二维码,但我在控制台打开 Angular 帮助页面时遇到此错误,但说使用 ngRoute Error: [$injector:modulerr] http://err
我正在尝试对此进行编码,只是使用路由从第一个页面跳转到另一个页面,但为什么它不起作用,我搜索并使用了很多技巧但仍然失败,请问有人吗? index.html Angular Js
this is the error i m getting.这个问题被问了很多次。但是下面的代码在在线编译器中运行良好,但在我的本地系统中运行不佳,即使系统已连接到互联网,它也显示未定义 Angula
我在尝试编写代码时遇到此错误。我已经完成了其他 Stackflow 问题,但找不到答案。是什么导致了这个错误? var app = angular.module("app", ['ui.router'
我正在使用 ngMateril 进行自定义对话框。但我收到错误为 Error: [$injector:modulerr]。我无法找出错误。任何帮助将不胜感激。 HTML 代码中的外部脚本
所以我绞尽脑汁有一段时间了,查看了每一行,但我似乎找不到任何错误。这是我的代码: HTML: About Contacts Log In
我是新手。刚刚学习/尝试将 Angular 与我的网络应用程序(Java + jQuery + requireJS)集成。我没有使用任何路由器,下面是我的脚本。来自其他stackoverflow我了解
原谅我。我看过很多同名的话题,但对我没有帮助。可能每个人都有特定的代码。 var app = angular.module('iop', []); // Set up the serv
尝试重现 angularjs 示例时出错
我遇到了 Angular JS 错误angular.js:36 未捕获错误: [$injector:modulerr] http://errors.angularjs.org/1.2.19/ $inj
可能是重复的( Failed to instantiate module error in Angular js ),但给定的措施(包括 HTML 中的 ng-route 并没有解决问题)。 这是错误
我是 AngularJS 新手,我正在尝试遵循可扩展应用程序的一些结构,并尝试让 Firebase 正常工作。但是,我在注入(inject)器上遇到了一个简单的错误。当我查看错误树时,它似乎都是 An
我是 AngularJS 的新手,正在通过一些文档和教程来学习。我的问题是关于 Egghead 的视频系列,特别是这个视频,演示了如何组合一个基本的搜索过滤器。我想在一个真实的应用程序中使用它,我正在
我正在尽我所能检查我的 JS,但我似乎找不到任何明显的问题。我得到以下信息: 未捕获错误:[$injector:modulerr] 无法实例化模块 careApp,原因是: 错误:[$injector
嘿伙计们,当我缩小我的 Angular JS 1 应用程序时,我收到一个错误 Error: $injector:modulerr ,到目前为止,我已经研究过这是我调用依赖项的方式 HomeContro
我是一名优秀的程序员,十分优秀!