link
can.route.link
can.route.link( innerText, data, props [, merge] )
Make an anchor tag (<A>
) that when clicked on will update can.route's properties
to match those in data
.
Parameters
-
innerText
{Object}
The text inside the link.
-
data
{Object}
The data to populate the route with.
-
props
{Object}
Properties for the anchor other than
href
. -
merge
{Boolean}
OptionalWhether the given options should be merged into the current state of the route.
Returns
{String}
A string with an anchor tag that points to the populated route.
Creates and returns an anchor tag with an href of the route attributes passed into it, as well as any properies desired for the tag.
Other attributes besides href can be added to the anchor tag by passing in a data object with the attributes desired.
It is possible to utilize the current route options when making anchor tags in order to make your code more reusable. If merge is set to true, the route options passed into
can.route.link
will be passed into the current ones.