-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($location): allow empty string URLs to reset path, search, and hash #10064
Conversation
Currently, providing '' to $location#url will only reset the hash, but otherwise has no effect. This change brings the behaviour of $location#url more inline with window.location.href, which when assigned to an empty string loads the page's base href. Before: $location.url() // http://www.example.com/path $location.url('') // http://www.example.com/path After: $location.url() // http://www.example.com/path $location.url('') // http://www.example.com Fixes angular#10063
This is very basic, and I tested to see that it behaves as I'd expect to, but... after digging in a bit more I realized that |
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
@mary-poppins are you still broken? 😢 |
@NevilleS the test is good, left one minor comment. Don't feel too strong about it but I find the proposed version more readable. WDYT? |
OK, cool, my comment is not valid really. LGTM. |
Thanks. I'm still unsure whether this constitutes a breaking change:
|
Yes, technically it is a breaking change. At the same time if someone is using |
@NevilleS did you sign the CLA? There is a new bot that can verify a signature but you need to update your CLA with the GitHub user name: http://angularjs.blogspot.fr/2014/11/angular-cla-infrastructure-changes.html |
Yes, I have. Hopefully @googlebot will agree... (bump bump) |
CLAs look good, thanks! |
Cool, thnx @NevilleS. Merging. |
👍 happy to help |
Currently, providing '' to $location#url will only reset the hash, but otherwise has no effect. This change brings the behaviour of $location#url more inline with window.location.href, which when assigned to an empty string loads the page's base href. Before: $location.url() // http://www.example.com/path $location.url('') // http://www.example.com/path After: $location.url() // http://www.example.com/path $location.url('') // http://www.example.com Fixes angular#10063 Closes angular#10064
Currently, providing '' to $location#url will only reset the hash, but otherwise has no effect. This
change brings the behaviour of $location#url more inline with window.location.href, which when
assigned to an empty string loads the page's base href.
Before:
$location.url() // http://www.example.com/path
$location.url('') // http://www.example.com/path
After:
$location.url() // http://www.example.com/path
$location.url('') // http://www.example.com
Fixes #10063