-
Notifications
You must be signed in to change notification settings - Fork 27.5k
html5Mode appbase regression in 1.1.5 #2799
Comments
Encounter same problem here. How can I fix this? Is this behavior normal? |
Let me just see if I understand this correct... If you go to: If that is the case, then this sounds like a severe error, and not just a behavior change... A changing App base is going to be horrible to work with? o.O... |
@jeme yes that's right. I changed the summary to 'regression' which should now sound more severe than behaviour change ;) |
@jeme Yes. But what do you mean that's a server error? |
@tomchentw Severe Error, Severe Bug, Severe Issue... And because that if you take my scenario, navigating to a "child" url inside an angular application or going directly to it though an external links leaves it in 2 different states, this is likely to break any existing angular app that uses HTML 5, not to mention how hard and illogical Html5 mode would behave... I would expect the 2 scenarios where: a. By Nav
b. By Direct
I would expect B to be Html 5 already present us with an option to define base path: http://www.w3schools.com/tags/tag_base.asp, alternatively let the |
@jeme Your expect of B is what I think. Would this problem be solved if Angular can find appBaseUrl using |
adding This seems to be a saner default. |
@clkao that fix doesn't work for us - if I set the base href then all the relatives links break. Would work if we switched to absolute links though. |
Same problem for me: routing is broken after switching from 1.1.4 to 1.1.5 :( Any suggestion to avoid this issue while keeping 1.1.5? |
I found what breaks my routing process: I'm using jstree and it preventDefault() on links. In AngularJS 1.1.5, they now check if the event isDefaultPrevented... I just have to find how to make them work together :) |
I can't see html5 mode working with page refreshes unless the app base is independent of the url the page was loaded on. Having the app base coming from the base tag doesn't work as it means relative links will not work. To be clear by app base I mean the path that '/' is relative to in the router. I would say app base should either default to '/' or have no default, you need to set the app base to activate HTML5 mode. |
@richardcrichardc I agree. |
@wcandillon How do you do that exactly? I'm just hitting this problem hard; my app has no deep linking, but my URLs are suddenly getting hosed with 1.1.5. Would like to try this solution. I can't use because it will screw up all my relative links. |
|
Ah, ok, I thought that was what you meant.. but that will wreck any relative links we have on the page. I suppose I could make them all absolute. But it looks like another solution has been found here: #2833 |
I second the suggestion from @jeme that $locationProvider have a method to set appBase so that it can be set without having to use the base[href] html tag. The fix from @IgorMinar aef0980 simply removes the appBase guessing in html5 mode. it is either taken from base[href] or simply '/' |
With the recent refactoring of $location service we changed this behavior resulting in a regression. Previously we thought that html5 mode always required base[href] to be set in order for urls to resolve properly. It turns out that base[href] is problematic because it makes anchor urls (#foo) to always resolve to the base url, which is almost always incorrect and results in all anchors links and other anchor urls (e.g. svg references) to be broken. For this reason, we should now start recommending that people just deploy to root context (/) and not set the base[href] when using the html5 mode (push/pop history state). If it's impossible to deploy to the root context then either all urls in the app must be absolute or base[href] must be set with the caveat that anchor urls in such app won't work. Closes #2762
Here i make a fix, you can apply to your local angular |
I noticed that 58ef323 introduced html5Mode behaviour changes for determining appbase.
With html5Mode, given an app http://foo/, and a deep link url http://foo/bar/baz that can be reached with ng-href or something within the application, the appbase is /. However if the user goes to http://foo/bar/baz directly, the appbase becomes http://foo/bar, leaving the $$path to be /baz, and this breaks url router or ui-router.
The text was updated successfully, but these errors were encountered: