我已将我的index.html中的脚本链接起来,并在app.js中引用它,但我一直收到ngRoute不可用的错误。任何帮助将不胜感激!
app.js
angular.module('gameMaster', ['ngRoute', 'castServices']);
的.config
angular.module('gameMaster')
.config(function($routeProvider, $locationProvider){
$routeProvider
//welcome page
.when('/welcome', {
templateUrl: '../../../../pages/welcome.html',
controller: 'gameController'
})
//gameplay page
.when('/gameplay',{
templateUrl: '../../../../pages/gameplay.html',
controller: 'gameController'
})
//default to welcome
.otherwise({
redirectTo: '/welcome'
});
$locationProvider.html5mode(true);
});
的index.html
<html>
<head>
<title>Party Things!</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular-route.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
<script type="text/javascript" src="node_modules/underscore/underscore.js"></script>
<script type="text/javascript" src="js/modules/castServices/castServices.js"></script>
<script type="text/javascript" src="js/modules/gameMaster/app.js"></script>
</head>
你有什么事吗?
谢谢!
答案 0 :(得分:19)
仅供记录。现在Angular将ngRoute模块作为单独的文件分发 - http://docs.angularjs.org/api/ngRoute
您需要下载angular-route.js并在您的网页中加入:
<script src="angular.js">
<script src="angular-route.js">
答案 1 :(得分:1)
事实证明我有缓存问题。当窗格打开时,我进入了开发人员选项并禁用了缓存,并且中提琴。谢谢你的帮助!