This is my JS (I set html5Mode to True and I am using $http $window
and $location
:
.config(['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true); // Important. Needed for URLs.
}])
.controller("MainCtrl", ["$http", "$window", "$location", function($http, $window, $location) {
The base tag is also set, like so:
<base href="/">
This is my html page:
<div>
<ul class="nav nav-pills">
<li><a href="/">Home ▼</a></li>
<li><a href='/post'>Post</a></li>
<li><a href="/settings">Settings</a></li>
<li><a href ng-click="ctrl.logoutUser()">Logout</a></li>
</ul>
</div>
The issue is, when I click any of the links, the URL updates but the page does not refresh. If I remove $location
from my controller then it works properly, but I need $location
to grab the URL from my JS for other purposes. Is there a way for me to stop AngularJS from preventing to refresh the webpage?