{{routeUrl(hashes)}}
Returns a url using route.url.
routeUrl( hashes... [,merge] )
Calls url with hashes as it's data argument and an
optional merge.
This can be used on its own to create <a> hrefs like:
<a href="{{ routeUrl(page='todos' id=todo.id) }}">details</a>
Or in conjunction with other helpers:
{{makeLink "details" routeUrl(page='todos', true)}}
{{routeUrl([merge], hashes...)}}
Passes the hashes to route.url and returns the result.
<a href="{{routeUrl(page='todos' id=todo.id)}}">details</a>
Parameters
- merge
{Boolean}:Pass
trueto create a url that mergeshashesinto the current can-route properties. - hashes
{Hash Expression}:A hash expression like
page='edit' recipeId=id.
Returns
{String}:
Returns the result of calling route.url.
Use
Use the routeUrl helper like:
<a href='{{routeUrl(page="recipe" id=5)}}'>{{recipe.name}}</a>
This produces (with no pretty routing rules):
<a href='#!&page=5&id=5'>{{recipe.name}}</a>
It this functionality could also be written as:
<a href='{{ routeUrl(page="recipe" id=5) }}'>{{recipe.name}}</a>
Using call expressions/parenthesis lets you pass the merge option to route. This
lets you write a url that only changes specified properties:
<a href='{{ routeUrl(id=5, true) }}'>{{recipe.name}}</a>
The following demo uses routeUrl and {{#routeCurrent(hash)}} to
create links that update can-route's page attribute:
It also writes out the current url like:
{{ routeUrl(undefined,true) }}
This calls route.url({}, true) which has the effect of writing out
the current url.