Help! I'm encountering this dreaded error message:
angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module usersApp due to:
Error: [$injector:modulerr] 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.
I can't figure out what's wrong with my code in app.js:
(function () {
var app = angular.module('usersApp',
['ngRoute']);
app.config(['$routeProvider', function ($routeProvider) {
var viewBase = '/';
$routeProvider
.when('/users', {
controller: 'MainController',
templateUrl: viewBase + 'users/users.html',
controllerAs: 'vm'
})
.when('/add', {
controller: 'OrdersController',
templateUrl: viewBase + 'add/orders.html'
})
.otherwise({ redirectTo: '/users' });
}]);
}());
This is how my index.html looks like:
<html>
<head>
<title>My Angular App!</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-app="usersApp" ng-controller="MainCtrl">
<h1>uSers</h1>
<div ng-repeat="user in users" ng-click="getUsers()" style="background: black; padding: 5px; min-width: 25px; color: white;">
{{user}}
</div>
</body>
</html>
Any help or advice is greatly appreciated!