Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
48
rated 0 times [  50] [ 2]  / answers: 1 / hits: 114244  / 11 Years ago, tue, november 26, 2013, 12:00:00

I encountered the following error with a root cause of Module 'ngRoute' is not available




Uncaught Error: [$injector:modulerr] Failed to instantiate module
Amail 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.




Javascript code :



var amailServices = angular.module('Amail',['ngRoute']);
function emailRouteConfig($routeProvider) {
$routeProvider.
when('/', {
controller: ListController,
templateUrl : 'list.html'}).

when('/view/:id',{
controller : DetailsController,
templateUrl:'detail.html'}).

otherwise({
redirectTo:'/'
});
}
amailServices.config(emailRouteConfig);


How to fix this


More From » angularjs

 Answers
9

You need to include angular-route.js in your HTML:



<script src=angular-route.js>


http://docs.angularjs.org/api/ngRoute


[#74062] Sunday, November 24, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trayvon

Total Points: 35
Total Questions: 117
Total Answers: 88

Location: Guernsey
Member since Tue, Jul 6, 2021
3 Years ago
;