I'm having trouble performing angular routing with asp.net mvc.
I configured my routing in the app.js and when I click on my links the pages are not being redirected correctly, only page that appears correctly is the Home.html, but after I click the links the same do not work, it changes the URL but it is always in the Home.html.
My Main Index
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="../Scripts/jquery-3.2.1.min.js"></script>
<script src="../Scripts/angular.js"></script>
<script src="../Scripts/angular.min.js"></script>
<script src="../Scripts/angular-route.min.js"></script>
<script src="../Scripts/angular-route.js"></script>
<script src="../AngularJS/app/app.js"></script>
<script src="../AngularJS/controller/homeController.js"></script>
<script src="../AngularJS/controller/autorController.js"></script>
<script src="../AngularJS/controller/editoraController.js"></script>
<script src="../AngularJS/controller/livroController.js"></script>
</head>
<body ng-app="app">
<a ng-href="#/Home"> Home </a> |
<a ng-href="#/Autor"> Listar Autores </a> |
<a ng-href="#/Editora"> Listar Editoras </a> |
<a ng-href="#/Livro"> Listar Livros </a>
<div ng-view="">
</div>
</body>
</html>
Configuring the JS Angle app
(function () {
var app = angular.module("app", ["ngRoute"]);
app.config(function ($routeProvider) {
$routeProvider
.when("/", { controller: "homeController", templateUrl: "/AngularJS/view/Home/Home.html" })
.when("/Livro", { controller: "livroController", templateUrl: "/AngularJS/view/Livro/Livro.html" })
.when("/Autor", { controller: "autorController", templateUrl: "/AngularJS/view/Autor/Autor.html" })
.when("/Editora", { controller: "editoraController", templateUrl: "/AngularJS/view/Editora/Editora.html" })
.otherwise({ redirectTo: "/" });
});
}());
Controller Home AngularJS
(function () {
angular.module("app").controller("homeController", function ($scope) {
$scope.home = " Home ";
});
}());
Controller Book Ahgular JS
(function () {
angular.module("app").controller("livroController", function ($scope) {
$scope.livro = "Primeiro Livro";
});
}());
HtmlPage Home
<div ng-controller="homeController">
Pagina Inicial - {{home}}
</div>
Html Page Book
<div ng-controller="livroController">
Livro Index - {{livro}}
</div>
Home open properly
WhenclickingontheBookLink-ChangestheurlbutdoesnotopentheBook.htmlpage
Filestructure