误差ngRoute不可 [英] Error ngRoute is not available
问题描述
有我的错误控制台
错误:[$喷油器:NOMOD]模块'ngRoute不可!你要么拼写错误的模块名称,或忘了加载它。如果注册一个模块,确保指定的依赖关系作为第二个参数。
这是我的index.html头:
this is my index.html header :
<script src="scripts/jquery-2.0.3.min.js" type="text/javascript"></script>
<script src="scripts/libs/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-route.js" type="javascript"></script>
<script src="scripts/app.js" type="text/javascript"></script>
</head>
这是我的app.js:
this is my app.js :
var app = angular.module('myapp', ['ngRoute']);
app.config(function($routeProvider){
$routeProvider
.when('/queueManager', {
templateUrl: '/templates/page/queueManager.html',
controller: 'QCtrl'
});
});
app.controller('QCtrl',['$http','$interval','$scope', function($http, $interval,$scope){
this.queues = queue;
var store = this;
store.queues = [];
var queue = [];
$http.get('/queue/info').success(function(data) {
store.queues = data;
});
});
这是我routes.js:
And this is my routes.js :
angular.module("myapp", ['ngRoute'])
.config(function($routeProvider){
$routeProvider.when('/queueManager', {
templateUrl: '/templates/page/queueManager.html'
})
});
在从Chrome开发工具,文件显示为加载,它似乎是我拼对了...
一个我仍然得到同样的错误如前所述。每次我在计算器搜索,这是同样的答案检查,如果你在你的HTML添加它...
你有关于我的问题解决了一些?
In dev tools from chrome, files appears as loaded, and it seems that i spelled it right... An I still get the same error as mentioned before. Every time i search on stackoverflow, it's the same answer check if you added it in your html... Have you some solution about my problem ?
编辑:在app.js新增的app.config并改变路线模块名来我的应用程序。并补充修改
感谢您
推荐答案
我终于找到了我的错误......
I finally found my mistake....
我的脚本类型是JavaScript和不文/ JavaScript的。有史以来最好的错误...
My script type was "javascript" and not "text/javascript". Best mistake ever ...
谢谢您的回答的方式。
这篇关于误差ngRoute不可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!