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

Commit 368039b

Browse files
dnozaypetebacondarwin
authored andcommitted
docs($location): explain difference between $location.host() and location.host.
Closes #11741 Closes #11744
1 parent 647f3f5 commit 368039b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: src/ng/location.js

+8
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,20 @@ var locationPrototype = {
412412
* This method is getter only.
413413
*
414414
* Return host of current url.
415+
*
416+
* Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
415417
*
416418
*
417419
* ```js
418420
* // given url http://example.com/#/some/path?foo=bar&baz=xoxo
419421
* var host = $location.host();
420422
* // => "example.com"
423+
*
424+
* // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
425+
* host = $location.host();
426+
* // => "example.com"
427+
* host = location.host;
428+
* // => "example.com:8080"
421429
* ```
422430
*
423431
* @return {string} host of current url.

0 commit comments

Comments
 (0)