I know there are a lot of questions about the routing not working in AngularJS. I have the same problem and after going through hundreds of answers I decided to post this question yet again. I have three files which are in the root folder in c:\intepub\wwwroot\angular\ and this means I am testing it under IIS. Now my problem is that when I put this URL in the browser: http://localhost/angular/index.html, browser redirects it to: http://localhost/angular/index.html#/ and the text on the page is: Testing routes
However, according to the code, it should go to login.html. And when I put http://localhost/angular/index.html#/test it still shows the same text: Testing routes.
Any ideas?
Thanks
The code is shown below:
index.html
<!DOCTYPE html>
<html ng-app="app">
<head></head>
<body>
<div>
Testing routes
<div ng-view=""></div>
</div>
<script src="dep/angular/angular.js"></script>
<script src="dep/angular/angular-route.js"></script>
<script>
var app = angular.module('app', ['ngRoute']);
app.config(appRouter);
function appRouter($routeProvider, $locationProvider)
{
$routeProvider
.when('/',
{
templateURL: 'login.html'
})
.when('/test',
{
templateURL: 'test.html'
})
.otherwise({tempate: "otherwise"});
}
</script>
</body>
</html>
login.html
<div>
Login Page
</div>
test.html
<div>
Test page
</div>
