[英]Error in my console - [$injector:modulerr] Failed to instantiate module starter due to: [$injector:nomod] Module 'starter' is not available
[英]Angular Error: [$injector:modulerr] Failed to instantiate module angularCharts due to: Error: [$injector:nomod]
这个问题已经被问过很多次了,但是在我看来,通常的回答没有帮助,因此将其发布。 我希望下面的代码跟着错误应该可以自我解释
错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module yoangfull2App due to:
Error: [$injector:modulerr] Failed to instantiate module angularCharts due to:
Error: [$injector:nomod] Module 'angularCharts' 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.
HTML:
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/json3/lib/json3.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/lodash/dist/lodash.compat.js"></script>
<script src="bower_components/angular-socket-io/socket.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/angular-charts/dist/angular-charts.js"></script>
Javascript:“严格使用”;
angular.module('yoangfull2App', ['angularCharts'])
.config(function ($routeProvider) {
$routeProvider
.when('/archives', {
templateUrl: 'app/archives/archives.html',
controller: 'ArchivesCtrl'
});
});
有多个角度图库可用。 首先检查您使用的是哪个,然后将该依赖项添加到您的项目中。 就像你在用
http://jtblin.github.io/angular-chart.js/
Charts.js是依赖项名称,或者如果您使用的是
http://chinmaymk.github.io/angular-charts/
并使用bower安装了它,然后按照此处建议的相同顺序添加它:
<script type='text/javascript' src='./bower_components/angular/angular.min.js'></script>
<script type='text/javascript' src='./bower_components/d3/d3.min.js'></script>
<script type='text/javascript' src='./bower_components/angular-charts/dist/angular-charts.min.js'></script>
您正在使用angular-chart.js吗? 如果这样做,则依赖关系为chart.js
,而不是angularCharts
。
检查您的angular-charts.js文件中的模块名称。 检查依赖项名称。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.