Skip to content

Commit bba61cd

Browse files
committed
doc($urlRouter): document href() method
1 parent 7057de4 commit bba61cd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/urlRouter.js

+25
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,31 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
352352
if (options && options.replace) $location.replace();
353353
},
354354

355+
/**
356+
* @ngdoc function
357+
* @name ui.router.router.$urlRouter#href
358+
* @methodOf ui.router.router.$urlRouter
359+
*
360+
* @description
361+
* A URL generation method that returns the compiled URL for a given
362+
* {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.
363+
*
364+
* @example
365+
* <pre>
366+
* $bob = $urlRouter.href(new UrlMatcher("/about/:person"), {
367+
* person: "bob"
368+
* });
369+
* // $bob == "/about/bob";
370+
* </pre>
371+
*
372+
* @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.
373+
* @param {object=} params An object of parameter values to fill the matcher's required parameters.
374+
* @param {object=} options Options object. The options are:
375+
*
376+
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
377+
*
378+
* @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
379+
*/
355380
href: function(urlMatcher, params, options) {
356381
if (!urlMatcher.validates(params)) return null;
357382

0 commit comments

Comments
 (0)