-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New unstable 1.1.5 broke $location URL parsing #2860
Comments
The wrong behavior happens in this.$$compose = function() {
var search = toKeyValue(this.$$search),
hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
}; |
I am quite sure that the problem was introduced in this commit: 58ef323 |
Yes, this is biting me too. (I raised it here: https://groups.google.com/forum/?fromgroups=#!topic/angular/dcfC4hfbUZs, no answer yet.) |
See also #2833 - this the real source of the problem I believe. |
Just +1 the annoyance on this one. I had brought $location in to one little directive and the next thing you know my urls were getting all mangled upon pageload. In general our frontend angular uses don't use routeProvider or locationProvider, so the fact it was modifying the urls was quite annoying. Temporary fix: removed $location for window.location as it does what we need for now. |
broken for us too |
👍 broke here as well... |
Should be fixed in master. On 30 June 2013 18:52, Alex Gorbatchev [email protected] wrote:
|
Can you give it a try? |
Good job guys, will give it a try! |
@petebacondarwin I have tried the current master and it still seems to be broken. Can somebody else confirm this? |
Can you provide a running example? Pete
|
I think the minimal example at the top of this issue should still demonstrate the issue (it is difficult to provide a plunkr example due to the window.location aspect). |
In which commit was the code regarding the bug fixed? Maybe I based my test on the wrong code... |
While not an exhaustive test, I did update and it seems to be fixed for me. |
Have a look at this PR: #2969 |
I still don't get the logic of this. It seems like it would be way better Michael Natkin On Thu, Jul 4, 2013 at 11:28 AM, Pete Bacon Darwin <[email protected]
|
@petebacondarwin: #2969 does not affect/fix this issue. We're talking about use cases where html5 mode is off and the app is not hosted at "/". I just tested master (which includes the patch) in this scenario: behavior on the test above seems to be identical to behavior of 1.1.5 as far as I could see. The unwanted redirection does not trigger in either version if you set:
(where page.html is the page in the server root where I dumped the code above)... but that hardly ever makes sense in the context of a non-html5 app, and forces one to use absolute links to all assets, which breaks external code (e.g., jquery-ui) that does not do that. |
> (where page.html is the page in the server root where I dumped the code above)... but that hardly ever makes sense in the context of a non-html5 app, and forces one to use absolute links to all assets, which breaks external code (e.g., jquery-ui) that does not do that. precisely... I've had to just stop using $location b/c I can't live with Michael Natkin On Fri, Jul 5, 2013 at 1:57 PM, jssebastian [email protected]:
|
I agree with @jssebastian : #2969 does not fix this, since that pull request only concerns html5mode. But the problem here occurs in hashbangMode. |
Just wanted to clarify, as no one has made it explicit in this thread. The issue is that visiting |
Fixed for me. Put the following in my html head: <base href="/"/> |
👍 |
If this is still broken for anyone in 1.3 or 1.2 latest, feel free to reopen this issue with an updated plunker. |
Since 1.1.5, the
$location
provider now appends a hash-part to the URL, which it shouldn't!Using plunkr for the test-case was problematic because of window.location. So, here is a minimal test-case as code that demonstrates the issue. Simply create an html-file with this code. Notice the URL change at the end after opening the page!
EDIT as @jssebastian clarified below: Visiting
page.html
, with no use of angular routing but only depending on $location, causes an unwanted redirection topage.html#/page.html
Test-case:
The text was updated successfully, but these errors were encountered: