mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-05-17 11:16:54 +08:00
revert: fix($location): return '/' for root path in hashbang mode
This reverts commit 63cd873fef.
The change breaks existing tests of Google apps. The problem is that
while we tried to avoid adding #/ to window.location.href unnecessarily
we failed doing so. Likely because by setting $path, at some point
(during a digest) we try to check if $location changed and we mistake the
default '/' with an explicit settign of the path via the `path()` method.
This results in us writing the url with '#/' into $browser.url() which updates
the window.location by adding "#/" to the url - something we tried to avoid
in the first place.
I'll reopen PR #5712.
This commit is contained in:
@@ -184,10 +184,6 @@ function LocationHashbangUrl(appBase, hashPrefix) {
|
||||
|
||||
this.$$compose();
|
||||
|
||||
if (!this.$$path) {
|
||||
this.$$path = '/';
|
||||
}
|
||||
|
||||
/*
|
||||
* In Windows, on an anchor node on documents loaded from
|
||||
* the filesystem, the browser will return a pathname
|
||||
|
||||
@@ -1487,16 +1487,6 @@ describe('$location', function() {
|
||||
expect(location.url()).toBe('/not-starting-with-slash');
|
||||
expect(location.absUrl()).toBe('http://server/pre/index.html#/not-starting-with-slash');
|
||||
});
|
||||
|
||||
|
||||
it("should return / for path for the application root path", function() {
|
||||
location = new LocationHashbangUrl('http://server/pre/index.html', '#');
|
||||
location.$$parse('http://server/pre/index.html');
|
||||
expect(location.path()).toBe('/');
|
||||
|
||||
location.$$parse('http://server/pre/');
|
||||
expect(location.path()).toBe('/');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user