Skip to content

IE 8 & 9 Index routing issue with angular 1.2.0 #576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wlingke opened this issue Nov 12, 2013 · 10 comments
Closed

IE 8 & 9 Index routing issue with angular 1.2.0 #576

wlingke opened this issue Nov 12, 2013 · 10 comments

Comments

@wlingke
Copy link

wlingke commented Nov 12, 2013

We are using ui-router 0.2.0 and we recently upgraded from angular 1.1.4 to angular 1.2.0 and noticed a weird issue. We are using

$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');

Our index state was defined as such:

.state("index", {
            url: "/",
            templateUrl: "/static/partials/general/index-router.html"
        })

This work correctly in chrome FF and IE10. However, when navigating to / in IE 9 or 8, it loads a blank page. I added an alert onEnter, and the alert doesn't execute so it seems like I never reach that state. This was not an issue and was properly working before we upgraded to angular 1.2.0.

A work around we used was adding:

.state("index2", {
            url: "",
            templateUrl: "/static/partials/general/index-router.html"
        })

This solved the problem and we are able to reach / in ie 9 or 8. However, an odd result is that when navigating to / from another state, it executes the state twice (we also added an onEnter alert and it executed twice).

Has anyone else come across a similar issue?

@timkindberg
Copy link
Contributor

Are you navigating to the state via a ui-sref? There is already a bug for that: see #350.

As far as needing to use "" instead of '/' that actually makes sense and isn't really a work around.

@wlingke
Copy link
Author

wlingke commented Nov 12, 2013

I'm navigating to it via a normal link and not ui-sref.

<a href="/">Index</a>

However, If I remove the href attribute and use ui-sref="index", I get the same double load result. If I use ui-sref="index2" nothing happens when I click on the link.

@timkindberg
Copy link
Contributor

Can you make a plunkr with the issue showing in IE?

@wlingke
Copy link
Author

wlingke commented Nov 12, 2013

http://plnkr.co/edit/aMFwBw
http://run.plnkr.co/plunks/aMFwBw/

The behavior you should see is every time you toggle from route1 to home, the counter should go up by 1. So you'll start at 1, click route1, then click home and you should see 2. Repeat this again and you'll see 3. This is the case in Chrome, FF, IE10

In IE 8 and 9, if you try this, you'll start at 1. Then after you click route 1 and home, you'll see 2 briefly and it'll reload to 1.

@tiffanyfrance
Copy link

I just came across this same issue. Adding the second index with an empty url fixed my issue in IE, though I hope for a better perm solution.

@rsnazell
Copy link

This worked for me:

$urlRouterProvider.when('', '/');

@brandonburkett
Copy link

Seconded that $urlRouterProvider.when('', '/'); worked for me.

@nicksloan
Copy link

the $urlRouterProvider.when('', '/'); trick is handy, but breaks down if you have query string parameters in the root state, so I had to do the duplicated state definition. This seems like a breaking change from upstream, so the question is whether it was an intentional feature, or an unintentional bug, and how ui-router should respond to it.

@sixinli
Copy link

sixinli commented May 20, 2015

Is $urlRouterProvider.when('', '/') the only solution here? it feels weird because there's actually an ending "/" in the URL in IE 8 & 9.

@eddiemonge
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants