Home page
I am using AngularJS with my ASP.Net MVC application and I am using angular routing but it is not working.
The angular routes are defined as:
var app = angular.module("webApp",['ngRoute']);
app.config(function($routeProvider){
$routeProvider.when(
"/",{
templateUrl: "home/dashboard",
controller: "webCtrl"
})
.when(
"/page1",{
templateUrl: "home/contact",
controller: "page1Ctrl"
})
.otherwise({
templateUrl: "home/contact",
controller: "page1Ctrl"
});
});
The navigation links are displayed on index.cshtml as given below:
<body ng-app="webApp">
<a href="#/">Home</a>
<a href="#page1">Page1</a>
<div ng-view></div>
</body>
It displays dashboard when launched but doesn't display contact page when second link is clicked. Also, it displays strange URLs. On the homepage it dislays http://localhost:58193/#!/ and when I click on page1 link URL gets changed to http://localhost:58193/#!/#%2Fpage1.Please let me know if I am mistaking anything.