I am new to angular and am having trouble with my routes. I am creating an angular SPA with .NET MVC and while the views do render I am noticing that I have 2 footers on the page(makes me guess the layout page is being rendered twice, but the body only loads the one time). I also set up some logging to see what is happening and from what I can tell it always misses the "when" cases the first time around but catches them the second time. Below is my config
angular.module("myApp")
.config(["$routeProvider", function ($routeProvider) {
$routeProvider
.when("/", {
templateUrl: "Home/Home",
controller: "HomeController",
message: function () { console.log("hit /") }()
})
.when("/login", {
templateUrl: "Home/Login",
controller: "LoginFormController",
message: function () { console.log("hit /login") }()
})
.otherwise({
message:function(){console.log("users think anything else will work")}(),
redirectTo:"/"
});
}]);
This is my console output when I hit http://localhost:54865/
hit /
hit /login
users think anything else will work
jquery-1.10.2.js:8686 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
VM1423:30269 WARNING: Tried to load angular more than once.
Any help getting in the right direction on how to fix this would be appreciated
Edit
I am using default MVC routing, I have a 'Home' controller with methods and views for 'Index', 'Home', and 'Login'. Index view only has
<div ng-view></div>
The 'Home' View has the default content provided by visual studio when creating a webapp using MVC (jumbotron, getting started, etc) and the login screen is my login screen.
this is the body of my layout file
<body ng-app="myApp">
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/angular")
@RenderSection("scripts", required: false)
</body>