{{routeUrl hashes}}
can.stache.helpers.routeUrl
Returns a url using can.route.url.
{{routeUrl hashes [,merge]}}
Passes the hashes to can.route.url
and returns the result.
Parameters
-
hashes
{Expressions}
A hash expression like
page='edit' recipeId=id
. -
merge
{Boolean}
OptionalPass
true
to create a url that mergeshashes
into the current can.route properties. Passing themerge
argument is only available in Call expressions likerouteUrl(id=itemId, true)
.
Returns
{String}
Returns the result of calling can.route.url
.
Use
Use the
routeUrl
helper like:This produces (with no pretty routing rules):
It this functionality could also be written as:
Using call expressions/parenthesis lets you pass the
merge
option tocan.route
. This lets you write a url that only changes specified properties:The following demo uses
routeUrl
and {{#routeCurrent hash}} to create links that update can.route'spage
attribute:It also writes out the current url like:
This calls
can.route.url({}, true)
which has the effect of writing out the current url.