Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

(IE9) Html 5 hashbang redirect causes controller to load twice #6104

Closed
worldspawn opened this issue Feb 4, 2014 · 3 comments
Closed

(IE9) Html 5 hashbang redirect causes controller to load twice #6104

worldspawn opened this issue Feb 4, 2014 · 3 comments

Comments

@worldspawn
Copy link

Hey, i have an app with html5 mode on. When a user clicks an external link (like from an email for example) to my application, eg: http://localhost:52388/confirm/GxPsil6Qra-qAp43VlKz0baE1MotUO4RcaAC7lGZkiAyweiweEh5HJNPV0vaNAcI6SEFgjW_5JjxhsuJBIAa1g2

In ie9 it gets rewritten as http://localhost:52388/#/confirm/GxPsil6Qra-qAp43VlKz0baE1MotUO4RcaAC7lGZkiAyweiweEh5HJNPV0vaNAcI6SEFgjW_5JjxhsuJBIAa1g2/

Sadly this also causes the controller I have associated with this route to load twice. In my scenario this controller immediately makes a post to the server to confirm something so its essentially confirming it twice. It doesn't happen with no ng-view in the page... although that's not very useful.

If the user navigates in with the url already hash banged then theres no problem

@vojtajina
Copy link
Contributor

Hmmm, I'm not sure if we can fix this. Any ideas?
We could probably make sure $location does the full page reload before compiler instantiates anything...

Can you use the hashbang url? (That should rewrite to a regular url on browsers that support it, however without full page reload).

@worldspawn
Copy link
Author

Yeh i figured out using the hashbang url works and am doing that for the time being. It does have an element of suck to it though, as does any IE related compromise. For whatever reason it doesn't cause the same problem with chrome despite its url changing from /#/confirm to /confirm

But I agree having the location do the full reload before the compiler gets busy is the way to go.

@linclark
Copy link
Contributor

It sounds like this one is resolved. Let me know if that's wrong and I'll reopen.

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

No branches or pull requests

3 participants