diff --git a/src/ng/location.js b/src/ng/location.js index dfe22cd000cd..4f5f802a47e1 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -413,12 +413,20 @@ var locationPrototype = { * 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. * * * ```js * // 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" * ``` * * @return {string} host of current url.