You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
@eheikes hmm, I've got impression that there is some confusion between methods of the $location service that is public and correctly returns host / port part:
it('should correctly parse a host with a protocol',function(){url=newLocationHtml5Url('http://host.com:8000/');url.$$parse('http://host.com:8000/?a+b=c+d');expect(url.host()).toEqual('host.com');expect(url.port()).toEqual(8000);expect(url.search()).toEqual({'a b':'c d'});});
In short: you shouldn't be looking at the docs for the internalurlResolve function and interpret it as a public API of $location - those are 2 different things.
I would love to clarify the docs to make it crystal clear what is returned from $location but I'm not sure I know how to do it. I mean - $location.host() returns a host name only and $location.port() returns just a port so I'm not sure more info is needed here.
But sure, if you can see how to make it clearer a PR would be awesome!
Am I missing something, or are the return values for some $location getters, specifically
protocol()
andhost()
, unclear?The $location documentation seems vague. The code comments for urlResolve(), which $location uses, says that the protocol includes the colon and the host includes the port, but this is demonstrably untrue.
Another source of confusion is the fact that
window.location.protocol
includes the colon andwindow.location.host
includes the port as well.Does $location and urlResolve maybe need improved docs?
The text was updated successfully, but these errors were encountered: