Skip to content

Commit

Permalink
doc($urlRouter): document href() method
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Apr 17, 2014
1 parent 7057de4 commit bba61cd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/urlRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,31 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
if (options && options.replace) $location.replace();
},

/**
* @ngdoc function
* @name ui.router.router.$urlRouter#href
* @methodOf ui.router.router.$urlRouter
*
* @description
* A URL generation method that returns the compiled URL for a given
* {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.
*
* @example
* <pre>
* $bob = $urlRouter.href(new UrlMatcher("/about/:person"), {
* person: "bob"
* });
* // $bob == "/about/bob";
* </pre>
*
* @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.
* @param {object=} params An object of parameter values to fill the matcher's required parameters.
* @param {object=} options Options object. The options are:
*
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
*
* @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
*/
href: function(urlMatcher, params, options) {
if (!urlMatcher.validates(params)) return null;

Expand Down

0 comments on commit bba61cd

Please sign in to comment.