1

I am having quiet some trouble getting my routing fixed. I really don't understand the error:

Uncaught Error:[$injection modulerr ]

What exactly causes it? I tried a couple of fixes but it just doesnt seem to work. I keep getting the same error

this my html code

var app=angular.module('myapp',["ngRoute"]);

//access the router function
app.config(function($routerProvider){
 $routerProvider
 .when('/',{
  templateUrl:"home.html",
  controller:'home'
 })
 .when('/admin',{
  templateUrl:"admin.html",
  controller:'admin'
 })
 .when('/legal', {
            templateUrl: "legal.html",
            controller: 'legal'
 })
 .when('/fianance', {
            templateUrl: "fianance.html",
            controller: 'fianance'
 })
 .otherwise({ redirectTo: '/' }); 
}); 

//access app controller
app.controller('myctrl', function ($location,$scope){
 $scope.currentpage="home";
 $scope.go=function(page){
  $location.path('/'+page);
 };
});


app.controller('home', function($scope, $location){});
app.controller('admin', function($scope, $location){});
app.controller('legal', function($scope, $location){});
app.controller('fianance', function($scope, $location){});
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Basepage</title>
</head>

<body ng-app="myapp" ng-controller="myctrl">
<form  ng-current="currentpage" ng-change="go(currentpage)">
<select>
<option value="p1">Admin</option>
<option value="pg2">Legal office</option>
<option value="pg3">Fianance</option>
<option value="p4">Home</option>
</select>
</form>
<div ng-view=""></div>
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<script src="https://code.angularjs.org/1.4.5/angular-route.js"></script>          
<script src="app.js"></script>
</body>
</html>

I would really appreciate if some could give me some pointersdsz

Smittey
  • 2,475
  • 10
  • 28
  • 35

0 Answers0