Hello I am trying to use angular routing. It is however throwing the error Error: $injector:modulerr Module Error
When i load pages nothing happens, where I want it to load the content from the corresponding HTML files.
Index.html
<!doctype html> <html ng-app="nepharia"> <head> <title>Nepharia</title> <meta charset='utf8' /> <link rel='stylesheet' href='/css/style.min.css' /> <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Montserrat:400,700|Open+Sans:300italic,300,400,400italic,600,600italic,700,700italic,800,800italic' /> <link rel='stylesheet' href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" /> <link rel="icon" href="/favicon.ico"> <base href="/"> </head> <body> <nav class="TopMenu"> <ul> <li class="logo"><a href="/">CinemaDesign</a></li> <li ng-class="getClass('/latest')"><a href="/latest">Latest movies</a></li> <li ng-class="getClass('/upcoming')"><a href="/upcoming">Upcoming movies</a></li> <li ng-class="getClass('/order')"><a href="/order">Your order</a></li> <li><a href="/info">Info</a></li> <li class="login right"><a href="/login"><i class="fa fa-user"></i></a></li> <li class="search"><a href="/search"><i class="fa fa-search"></i></a></li> </ul> </nav> <main ng-cloak ng-controller="mainCtrl" class="light"></main> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-route.min.js"></script> <script src="/js/script.js"></script> </body> </html> script.js
var nepharia = angular.module('nepharia', ['ngRoute']); nepharia.config(function ($routeProvider,$locationProvider, $location) { $routeProvider .when('/', { templateUrl : '/v/typography.html', controller : 'mainCtrl' }) .when('/latest', { templateUrl : '/v/latest.html', controller : 'mainCtrl' }) .when('/upcoming', { templateUrl : '/v/upcoming.html', controller : 'mainCtrl' }) .when('/order', { templateUrl : '/v/order.html', controller : 'mainCtrl' }).otherwise({ redirectTo: '/' }); $locationProvider.html5Mode(true); }); nepharia.controller('mainCtrl', function ($scope) { $scope.getClass = function (path) { if ($location.path().substr(0, path.length) == path) { return "active" } else { return "" } } }); If it helps, you can see the site I am playing with at nepharia.net
Thanks in advance!
$locationinto your.configfunction. However, I would also like to suggest, when you are trying to debug errors with Angular, it's really much easier to interpret the errors if you useangular.jsinstead ofangular.min.js