Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$location.host() is not consistent with location.host / documentation incomplete #11741

Closed
@dnozay

Description

@dnozay

see also issue #9754.
see also http://www.w3schools.com/jsref/prop_loc_host.asp
see also https://docs.angularjs.org/api/ng/service/$location

Browser pointing to http://127.0.0.1:9000/#/home,

  • $location.host() returns 127.0.0.1, whereas
  • location.host returns 127.0.0.1:9000

This is the current doc (at time of reporting the issue)

// given url http://example.com/#/some/path?foo=bar&baz=xoxo
var host = $location.host();
// => "example.com"

This example is insufficient for someone to figure out that this does not return the same as location.host. It would be great to add a warning, more examples or change the behavior to match location.host.

Suggested examples:

// given url http://example.com:8080/#/some/path?foo=bar&baz=xoxo
var host = $location.host();
// => "example.com"
// given url http://user:[email protected]:8080/#/some/path?foo=bar&baz=xoxo
var host = $location.host();
// => "example.com"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions