I've successfully developed a web app, and now I need to replicate the same HTML page with a slightly different controller. Despite my attempts to utilize ngRoute, it's not functioning as expected, and I'm uncertain if my route setup will yield the desired outcome.
Upon running my code, I encounter the following error: Failed to instantiate module ngRoute due to: Error: [$injector:nomod] Module 'ngRoute' 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.
Edit: I've included Angular-route.js in my index file, but I'm now receiving the error "Unknown provider: $routeProvider"
Can someone shed light on why my routes aren't functioning correctly?
Here is the snippet of my code:
App.js (Routing Section)
app = angular.module('rcr_sched', ['ngRoute']);
app.config(['$routeProvider',
function($routeProvider){
When('/',{
templateUrl: 'index.html',
controller: 'main'
}).
When('/drill',{
templateUrl: 'drill.html',
controller: 'drill'
}).
otherwise({
redirectTo: '/'
});
}
]);
Index.html
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="app.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<script type="text/javascript" scr="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-route.js"></script>
<script src="js/angular.js"></script>
<script src="js/angular-route.js"></script>
<script src="js/domo.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-app="rcr_sched" ng-controller="main">
<div id="mydiv" ng-view>
<table>
<tr>
<th id="printc"><button id="print" class="fa fa-print fa-2x" onclick="print('#mydiv')"></button></th>
<th ng-repeat="prop in columns">{{prop.date}}</th>
</tr>
<tr ng-repeat="r in data">
<td id="linkc">
<button id="link" class="fa fa-plus-square fa-1x" onclick="href='#/drill'"></button>
</td>
<td align="center" ng-repeat="prop2 in columns" class="{{getColor(r.TeamRank, r.Team, prop2.title)}}" style="{{isPTO(prop2.title, 'PTO' + prop2.title, r['PTO' + prop2.title])}}">
{{r[prop2.title]}}
</td>
</tr>
</table>
</div>
</body>
</html>
Drill.html
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="app.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angular-ui-router/1.0.0-rc.1/angular-ui-router.min.js"></script>
<script src="js/angular.js"></script>
<script src="js/domo.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-app="rcr_sched" ng-controller="main">
<div id="mydiv">
<table>
<tr>
<th><button id="print" class="fa fa-print fa-2x" onclick="print('#mydiv')"></button></th>
<th ng-repeat="prop in columns">{{prop.date}}</th>
</tr>
<tr ng-repeat="r in data">
<td>
<button id="link" class="fa fa-plus-square fa-1x" onclick="href='#/'"></button>
</td>
<td align="center" ng-repeat="prop2 in columns" class="{{getColor(r.TeamRank, r.Team, prop2.title)}}" style="{{isPTO(prop2.title, 'PTO' + prop2.title, r['PTO' + prop2.title])}}">
{{r[prop2.title]}}
</td>
</tr>
</table>
</div>
</body>
</html>