register
Create a route matching rule.
route.register(rule [, defaults])
Create a url matching rule. Optionally provide defaults that will be applied to the underlying data when the rule matches.
The following sets route.data.page = "cart" when the url is #cart and
route.data.page = "home" when the url is #.
route.register( "{page}", { page: "home" } );
Parameters
- rule
{String}:the fragment identifier to match. The fragment identifier should contain characters (a-Z), optionally wrapped in braces ( { } ). Identifiers wrapped in braces are interpreted as being properties on can-route’s map. Examples:
route.register( "{foo}" ); route.register( "foo/{bar}" ); - defaults
{Object}:An object of default values. These defaults are applied to can-route’s map when the route is matched.
Returns
{Object}:
The internal route object. Use values on this object with caution. It is subject to change.