{{#routeCurrent hash}}
can.stache.helpers.routeCurrent
Returns if the hash values match the can.route's current properties.
{{#routeCurrent hashes}}SUBEXPRESSION{{/routeCurrent}}
Renders SUBEXPRESSION if the hashes passed to can.route.current returns true.
Renders the {{else}} expression if can.route.current returns false.
Parameters
-
hashes
{Expressions}A hash expression like
page='edit' recipeId=id.
Returns
{String}
The result of SUBEXPRESSION or {{else}} expression.
routeCurrent([hashes])
Calls can.route.current with hashes and returns the result.
Parameters
-
hashes
{Expressions}A hash expression like
page='edit' recipeId=id.
Returns
{Boolean}
Returns the result of calling can.route.current.
Use
Use the
routeCurrenthelper like:With default routes and a url like
#!&page=5&id=5, this produces:It this functionality could use call expressions like:
The following demo uses
routeCurrentand {{routeUrl hashes}} 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.