@@ -327,6 +327,13 @@ var locationPrototype = {
327
327
* Return full url representation with all segments encoded according to rules specified in
328
328
* [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
329
329
*
330
+ *
331
+ * ```js
332
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
333
+ * var absUrl = $location.absUrl();
334
+ * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
335
+ * ```
336
+ *
330
337
* @return {string } full url
331
338
*/
332
339
absUrl : locationGetter ( '$$absUrl' ) ,
@@ -342,6 +349,13 @@ var locationPrototype = {
342
349
*
343
350
* Change path, search and hash, when called with parameter and return `$location`.
344
351
*
352
+ *
353
+ * ```js
354
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
355
+ * var url = $location.url();
356
+ * // => "/some/path?foo=bar&baz=xoxo"
357
+ * ```
358
+ *
345
359
* @param {string= } url New url without base prefix (e.g. `/path?a=b#hash`)
346
360
* @return {string } url
347
361
*/
@@ -366,6 +380,13 @@ var locationPrototype = {
366
380
*
367
381
* Return protocol of current url.
368
382
*
383
+ *
384
+ * ```js
385
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
386
+ * var protocol = $location.protocol();
387
+ * // => "http"
388
+ * ```
389
+ *
369
390
* @return {string } protocol of current url
370
391
*/
371
392
protocol : locationGetter ( '$$protocol' ) ,
@@ -379,6 +400,13 @@ var locationPrototype = {
379
400
*
380
401
* Return host of current url.
381
402
*
403
+ *
404
+ * ```js
405
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
406
+ * var host = $location.host();
407
+ * // => "example.com"
408
+ * ```
409
+ *
382
410
* @return {string } host of current url.
383
411
*/
384
412
host : locationGetter ( '$$host' ) ,
@@ -392,6 +420,13 @@ var locationPrototype = {
392
420
*
393
421
* Return port of current url.
394
422
*
423
+ *
424
+ * ```js
425
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
426
+ * var port = $location.port();
427
+ * // => 80
428
+ * ```
429
+ *
395
430
* @return {Number } port
396
431
*/
397
432
port : locationGetter ( '$$port' ) ,
@@ -410,6 +445,13 @@ var locationPrototype = {
410
445
* Note: Path should always begin with forward slash (/), this method will add the forward slash
411
446
* if it is missing.
412
447
*
448
+ *
449
+ * ```js
450
+ * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
451
+ * var path = $location.path();
452
+ * // => "/some/path"
453
+ * ```
454
+ *
413
455
* @param {(string|number)= } path New path
414
456
* @return {string } path
415
457
*/
@@ -435,10 +477,9 @@ var locationPrototype = {
435
477
* var searchObject = $location.search();
436
478
* // => {foo: 'bar', baz: 'xoxo'}
437
479
*
438
- *
439
480
* // set foo to 'yipee'
440
481
* $location.search('foo', 'yipee');
441
- * // => $location
482
+ * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
442
483
* ```
443
484
*
444
485
* @param {string|Object.<string>|Object.<Array.<string>> } search New search params - string or
@@ -508,6 +549,13 @@ var locationPrototype = {
508
549
*
509
550
* Change hash fragment when called with parameter and return `$location`.
510
551
*
552
+ *
553
+ * ```js
554
+ * // given url http://example.com/some/path?foo=bar&baz=xoxo#hashValue
555
+ * var hash = $location.hash();
556
+ * // => "hashValue"
557
+ * ```
558
+ *
511
559
* @param {(string|number)= } hash New hash fragment
512
560
* @return {string } hash
513
561
*/
0 commit comments