Skip to content

Commit

Permalink
revert: fix($location): return '/' for root path in hashbang mode
Browse files Browse the repository at this point in the history
This reverts commit 63cd873.

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 angular#5712.
  • Loading branch information
IgorMinar authored and jamesdaily committed Jan 27, 2014
1 parent 5d73ddb commit 6689dc9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
4 changes: 0 additions & 4 deletions src/ng/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions test/ng/locationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('/');
});
});


Expand Down

0 comments on commit 6689dc9

Please sign in to comment.