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

Routing and HTML5-mode links broken #2537

Closed
nil4 opened this issue Apr 29, 2013 · 6 comments
Closed

Routing and HTML5-mode links broken #2537

nil4 opened this issue Apr 29, 2013 · 6 comments

Comments

@nil4
Copy link

nil4 commented Apr 29, 2013

Given an application hosted at http://domain/en/test/, using AngularJS v1.1.5-77ff108, $location.path() does not include the /en/test prefix, and as a result, no link matches the configured routes. Reproduced in Chrome 26, Firefox 20 and IE 10 running on two separate machines (Windows 7 and 8, respectively).

See https://gist.github.com/nil4/5444928 for a complete example; you need to host these files under http://domain/en/test/ to reproduce (domain is a placeholder, you can use any host name). Expected: all links except the last one should show the partial.html view; actual: all links show the notfound.html view.

This looks like a regression from v1.1.3 and v1.1.4 where this scenario works as expected. Originally reported at #2485 but probably unrelated.

@leon
Copy link

leon commented Apr 29, 2013

I saw your gist and thought I'd share with you how I you can set a base url for an app and then work with ./ to work from the base href and forward...

https://gist.github.com/leon/5483031

@nil4
Copy link
Author

nil4 commented May 2, 2013

@leon: Thank you for your suggestion! I took it to its logical extreme and set <base href='/' /> and kept all URLs root-relative, similar to how our application works; this fixed the symptoms of the issue.

I updated https://gist.github.com/nil4/5444928 with this workaround and the latest Angular (v1.1.5-dc9a580). Removing the <base> element from index.html triggers the broken behavior I originally reported.

Since all URLs are root-relative, I think they should be interpreted as-is and setting the base href to / should not be necessary. I see this behavior as a regression from previous AngularJS versions. @petebacondarwin, @mhevery: what do you think?

@darkpicnic
Copy link

Hugely helpful. I was getting infinite recursion without the base href being set.

@thenikso
Copy link
Contributor

thenikso commented Jul 2, 2013

This should have been addressed in #2762

@mavericreal
Copy link

+1

@btford
Copy link
Contributor

btford commented Jan 14, 2014

This has since been resolved.

@btford btford closed this as completed Jan 14, 2014
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

6 participants