Skip to content


Subversion checkout URL

You can clone with
Download ZIP


$location + html5 mode + legacy browser + #url('/newUrl') => full page reload #1102

IgorMinar opened this Issue · 27 comments

it seems that we do something wrong when $location is in html5 mode and we run in a browser that doesn't support history.pushState and we change url with $location#url() method.

angular.module('myApp', [])

function MyCtrl($scope, $location) {
   $scope.changeURL = function() {
<a href ng-click="changeURL()">click here to see full page reload</a>

originally reported at:!topic/angular/k-i6UYa7KpQ


I experience similar problem in a Chrome (22.0.1216.0 canary) with html5mode=false;

The url schema is:

.when('/users', {templateUrl: 'partials/list.html', controller: UserListCtrl})
.when('/users/:userId', {templateUrl: 'partials/user-detail.html', controller: UserDetailCtrl})

When i use ng-click to return from /users/userId to /users with location.path('/users'), browser first correctly goes to #/users, displays the expected partial, an just in a moment reloads the page with ?#/users url.

Navigation to /users from /users/userId with a simple anchor href="#/users" works fine.


I am having a similar issue. When hitting a "deep link" on IE, angular will redirect to the hashbang version, but it will throw errors in the IE console that 10 $digest() iterations have been reached - I asked about this on the mailing list

I also experience this when visiting the angular api documentation on IE


EDIT: Since my problem isn't legacy browser related and is currently breaking all my ng-click anchors, I'll post on google groups and maybe submit a separate ticket.

----------------- Original Post Follows ----------------------

This is a similar issue to the problem I'm having, so I thought I'd comment here. If not appropriate, I can file separately. It's happening for me on Chrome dev (22) and FF14, so for me it's not a legacy browser problem in my case.

I have a problem where a blank href in an anchor performs the ng-click function and is still redirecting me to the base href of my app.

 <a href="" ng-click="myFunction()">link 1</a>

I'm using html5Mode and have a <base href="/app/">

Perhaps I'm routing incorrectly or there's a better way.

Here's a link to reproducing the problem against angular-seed.


I am observing same issue as bonya. It happens only in Chrome (my version is 20) and also happens also in html5mode = true

/somepath is redirected to /somepath? causing page load


This could be related to issue #1090 which is a cookie issue that stems from the "baseHref" function returning undefined on some browsers. This function is called from 2 places in Angular:

  • cookiePath in the ng.$browser#cookies function
  • basePath in the ng.$locationProvider#html5Mode function

This failure may depend on whether the you're using jQuery or the Angular jQuery-lite library.


more observation:

  • I am using regular jQuery
  • when I wrapped $location.path call in 1ms $timeout, it work fine also in chrome

I've got the same issue. It seems that the problem occurs only after going back to route, that has been previously visited. Chrome 21, html5 = false.


angular.module('phonecat', []).
config(function ($routeProvider, $locationProvider) {
// $locationProvider.html5Mode(true);
// $locationProvider.html5Mode(true);
when('/phones', { templateUrl: 'AngularMVC/partials/phone-list.html', controller: PhoneListCtrl }).
when('/phones/:phoneId', { templateUrl: 'AngularMVC/partials/phone-detail.html', controller: PhoneDetailCtrl }).
otherwise({ redirectTo: '/phones' });
// $locationProvider.html5Mode(true).hashPrefix('!');


But when i click on phone templateURL field is not set properly any idea


isnt that fixed yet?


Is this fixed? I seem to be having this problem.


wrapping $timeout did the trick, but IE works in hashbang mode and this hack doesn't help


I am seeing this same issue when using IE9. Posted to AngularJS group here:!topic/angular/_iP4sGnLmqo

The associated Plunker:


I see that this issue is still open, is this at least fixed farther along the 1.0.x branch? Or farther along 1.x? This is causing serious headaches.


Looking for an answer here as well. Thanks.


hi guys, is there a chance to solve this issue? :-(


Having the same issue. Any updates?


Any updates?


bump? I think i have the same issue (angular 1.2.4)


I am having the same problem in IE9. Full refresh loop. The path is appended to the URL in each iteration of the loop.

@jeffbcross jeffbcross added this to the Backlog milestone

Any resolution with this? This is happening in IE9.


I'm getting it in IE9 also, refresh loop with the location being appended each time. Angular 1.2.16.


We're also struggling with this issue in IE9. Any workarounds would be greatly appreciated!

@btford btford removed the gh: issue label

I have this issue with IE 11 only for the moment. html5mode is off.
IE 11 allows navigating to '#/path' and then to '#/path/subpath', but nothing happens when clicking '#/path' again. Have been struggling with this for a long period with no luck.


@DenisVuyka you have a separate issue then, this one is reserved for HTML5 mode.


Hi, I have same issue using chrome.
html5mode is set as true, and $location.path('/any/path') is causing full reload.
I'm using angular-1.3.0-beta.17
Any suggestion or workaround?


@mblasi 1.3.0-beta.17 is several months old - please try the latest 1.3.x version and open a separate issue with a clear reproduce scenario if you are still bumping into problems.

@Narretz Narretz removed the PRs plz! label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.