Reputation: 23
iam new in angularJs.i am using wamp server and it loads to the html page but doesnot shows the view.i have used ng-app in body also but it doesnot loads the view
<!DOCTYPE html>
<html>
<head>
<title>AngularJs | Basic Login Form</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="angular-route.min.js"></script>
<!-- -->
</head>
<body>
<body ng-app="myApp">
<div ng-view>
</div>
<script>
var myApp = angular.module("myApp",["ngRoute"]);
myApp.config(function($routeProvider){
$routeProvider
.when('/', {
templateUrl: 'page.html'
})
.when('/hello',{
templateUrl:'hello.html'
})
.otherwise({
redirectTo: '/'
});
});
</script>
</body>
</html>
Upvotes: 0
Views: 79
Reputation: 788
Your code works when using the latest libraries of Angular (I couldn't find router 1.2.23, which is pretty outdated anyway), as you can see here:
https://plnkr.co/edit/OOSHyNjIIIibeX03pVuB?p=preview
This is the code i've changed:
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.10/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.10/angular-route.min.js"></script>
<!-- -->
</head>
<body ng-app="myApp">
By the way, you have duplicate body tag. You might want to remove that.
Upvotes: 1