{{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
trueto create a url that mergeshashesinto the current can.route properties. Passing themergeargument is only available in Call expressions likerouteUrl(id=itemId, true).
Returns
{String}
Returns the result of calling can.route.url.
Use
Use the
routeUrlhelper like:This produces (with no pretty routing rules):
It this functionality could also be written as:
Using call expressions/parenthesis lets you pass the
mergeoption tocan.route. This lets you write a url that only changes specified properties:The following demo uses
routeUrland {{#routeCurrent hash}} to create links that update can.route'spageattribute:It also writes out the current url like:
This calls
can.route.url({}, true)which has the effect of writing out the current url.