can-route
Version:
Observable front-end application routing for CanJS.
27 lines (17 loc) • 1.03 kB
Markdown
data )`
Parameterizes the raw JS object representation provided in data. Any remaining data is added at the end of the URL as & separated key/value parameters.
```js
import {route} from "can";
route.register( "{type}/{id}" );
const video = route.param( { type: "video", id: 5 } );
console.log( video ); // -> "video/5"
const notNewVideo = route.param( { type: "video", id: 5, isNew: false } );
console.log( notNewVideo ); // -> "video/5&isNew=false"
```
{data} object The data to populate the route with.
{String} [currentRouteName] 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 `currentRouteName` will be used.
{String} The route, with the data populated in it.
can-route.param param
can-route.static
Creates a url fragment that represents provided state.
`route.param(