-
Notifications
You must be signed in to change notification settings - Fork 27.5k
IE8, html5Mode route to root error & fix #6832
Comments
Can you send a pull request so it can be reviewed? Thanks. |
Thank you for your replay, I will create it a pull request. |
If I understand it correctly you are saying that if your app is at http://myapp.com and you open http://myapp.com in IE8 then nothing happens. Is that right? |
I tested this scenario with IE8 on http://docs.angularjs.org/ and it works as expected (the app itself is broken mainly because of CSS issues, but angular will redirect to http://docs.angularjs.org/!#/api) |
Hi, yes, steps to reproduce:
|
I've also send pull request - https://github.com/angular/angular.js/pull/6834/files |
I've seen the PR. It doesn't have any tests so I can't tell if it does anything. My point is that the case you described works just fine for docs.angularjs.org which uses the same setup. So I'm thinking that there is another variable that you haven't mentioned. |
Yes, you're right. $routeProvider |
…Mode Previously, LocationHashbangInHtml5Url, which is used when html5Mode is enabled in browsers which do not support the history API (IE8/9), would behave very inconsistently WRT relative URLs always being resolved relative to the app root url. This fix enables these legacy browsers to behave like history enabled browsers, by processing href attributes in order to resolve urls correctly. Closes angular#6162 Closes angular#6421 Closes angular#6899 Closes angular#6832 Closes angular#6834
…Mode Previously, LocationHashbangInHtml5Url, which is used when html5Mode is enabled in browsers which do not support the history API (IE8/9), would behave very inconsistently WRT relative URLs always being resolved relative to the app root url. This fix enables these legacy browsers to behave like history enabled browsers, by processing href attributes in order to resolve urls correctly. Closes #6162 Closes #6421 Closes #6899 Closes #6832 Closes #6834
Hi,
I was testing route with html5Mode(true) in IE8. Angular for IE8 sets html5Mode to false and uses hashbang, instead of HTML5 history API.
But problem is when you route to the root url of your site, nothing is shown.
router:
$routeProvider.
when('/', {
templateUrl: '/partials/phone-list.html',
controller: 'PhoneListCtrl'
}).
otherwise({redirectTo: '/'});
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
I found out the solution for this problem:
function LocationHashbangUrl(appBase, hashPrefix) {
and inside function:
this.$$parse = function(url) {
if (!url) {
url = appBase;
}
I've added three lines which contains check for empty url - when you route to the root of your website.
Can be this fix included to the next 1.2.x version of AngularJS ?
The text was updated successfully, but these errors were encountered: