Reputation: 93
i am trying to create a SPA(Single Page Application) with angular routing but when i add ndRoute to my module, it gives me this error
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=Dental&p1=Error%3A…tp%3A%2F%2F127.0.0.1%3A51792%2FDemoDental%2Fjs%2Fangular.min.js%3A17%3A381)
this is my js code
(function(){
var app= angular.module("Dental", ['ngRoute']);
app.config([$routeProvider,function($routeProvider) {
$routeProvider.when('/aggrement', {
templateUrl : 'templates/aggrement.html'
}).otherwise({
redirectTo : '/home'
});
}]);
})();
this is my HTML code
<!DOCTYPE html>
<html ng-app="Dental">
<head>
<title>DemoDental</title>
<meta name="viewport"
content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,user-scalable=no" />
<link rel="stylesheet" href="styles/styles.css">
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/angular.min.js"></script>
</head>
<body>
<div>
</div>
<!-- angular templating -->
<!-- this is where content will be injected -->
<div ng-view id="changeDiv"></div>
</div>
<script src="js/main.js"></script>
</body>
</html>
i cant get the reason for this error as everything seems good to me ,
the programme run well if i remove ngRoute from my angular.module()
.
Thanks in advance
Upvotes: 1
Views: 2099
Reputation: 179
add angular route
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular-route.js"></script>
Upvotes: 3