我正在尝试设置一些基本路由,但继续面临[$injector:modulerr]
控制台中的错误。我已经将它包含angular-route.js
在我的应用程序中,因为它现在已经被移动到它自己的模块中。但是,我仍然收到此错误。
JS:
// App initialiser
var module = angular.module('MyApp', ['ngRoute']);
// Routing config
module.config(function($routeProvider){
$routeProvider.
when('/NewOrder', {
templateUrl: 'templates/addOrder.htm',
controller: 'addOrderController'
}).
when('/ShowOrders', {
templateUrl: 'templates/showOrders.htm',
controller: 'showOrdersController'
}).
otherwise({
redirectTo: '/NewOrder'
});
});
// Add Order Controller
module.controller('addOrderController', function($scope){
$scope.message = "This is the Add Order screen.";
});
// Show Orders Controller
module.controller('showOrdersController', function($scope){
$scope.message = "This is the Show Orders screen.";
});
HTML(ng-app 包含在我的 html 标签中):
<div class="container">
<nav>
<ul>
<li><a href="#NewOrder"> New Order </a></li>
<li><a href="#"> New Contact </a></li>
<li><a href="#ShowOrders"> Show Orders </a></li>
<li><a href="#"> Show Contacts </a></li>
</ul>
</nav>
<div ng-view="">
</div>
</div>
<!--SCRIPTS-->
<script type="text/javascript" src="vendor/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular-route.min.js">
<script type="text/javascript" src="scripts/controller.js"></script>