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

Commit 84daf97

Browse files
dnozaypetebacondarwin
authored andcommitted
docs($location): explain difference between $location.host() and location.host.
Closes #11741 Closes #11744
1 parent 426a5ac commit 84daf97

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ng/location.js

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

0 commit comments

Comments
 (0)