param
Get a route path from given data.
route.param(data)
Parameters
- object
{data}
:The data to populate the route with.
- currentRouteName
{String}
:The current route name. If provided, this can be used to "stick" the url to a previous route. By "stick", we mean that if there are multiple registered routes that match the
object
, the thecurrentRouteName
will be used.
Returns
{String}
:
The route, with the data populated in it.
Parameterizes the raw JS object representation provided in data.
route.param({ type: "video", id: 5 });
// -> "type=video&id=5"
If a route matching the provided data is found, that URL is built from the data. Any remaining data is added at the end of the URL as & separated key/value parameters.
route.register("{type}/{id}");
route.param({ type: "video", id: 5 }) // -> "video/5"
route.param({ type: "video", id: 5, isNew: false })
// -> "video/5&isNew=false"