host();
This method is getter only.
Return host of current url.
Note: compared to the non-angular version location.host
which returns hostname:port
, this returns the hostname
portion only.
// given url http://example.com/#/some/path?foo=bar&baz=xoxo var host = $location.host(); // => "example.com" // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo host = $location.host(); // => "example.com" host = location.host; // => "example.com:8080"
Returns
string |
host of current url. |
Please login to continue.