...
 
Commits (5)
......@@ -35,22 +35,22 @@ Displays a menu and handle the navigation for you.
### `<sib-router>` attributes:
- **default-route**: The `name` attribute of the default `<sib-route>` displayed.
- **route-prefix**: If you app is not run from the root of your domain name, for instance `www.your-domain.com/some-uri`, you should set `route-prefix` to `"some-uri"`.
- **use-hash**: If you can't rewrite the URLs on your server, you might want to set this attribute to use `location.hash` instead of `location.pathname` as URLs.
- **`default-route`**: The `name` attribute of the default `<sib-route>` displayed.
- **`route-prefix`**: If you app is not run from the root of your domain name, for instance `www.your-domain.com/some-uri`, you should set `route-prefix` to `"some-uri"`.
- **`use-hash`**: If you can't rewrite the URLs on your server, you might want to set this attribute to use `location.hash` instead of `location.pathname` as URLs.
### `<sib-route>` attributes:
- **name**: The name of the route. Must match the id of the view that is to be displayed. The same name is used as a url identifier as well.
- **rdf-type**: Can be used as an alternative of `name`. The route will be activated if a resource with the given type is passed to the router.
- **active**: This attribute is present on route being displayed by `<sib-router>`. It is automatically added/removed by `<sib-router>` and should not be tinkered manually.
- **`use-id`**: indicates that the route takes an id.
- **`name`**: The name of the route. Must match the id of the view that is to be displayed. The same name is used as a url identifier as well.
- **`rdf-type`**: Can be used as an alternative of `name`. The route will be activated if a resource with the given type is passed to the router.
- **`active`**: This attribute is present on route being displayed by `<sib-router>`. It is automatically added/removed by `<sib-router>` and should not be tinkered manually.
## sib-link
`<sib-link>` accepts the following attributes:
- **next**: The `name` attribute of the `<sib-route>` you want to access.
- **`next`**: The `name` attribute of the `<sib-route>` you want to access.
Example :
```html
......
......@@ -29,7 +29,7 @@
<body>
<sib-router default-route="list" route-prefix="examples/route-with-id.html">
<sib-route name="list">Members list</sib-route>
<sib-route name="member"></sib-route>
<sib-route name="member" use-id></sib-route>
</sib-router>
<div id="list">
......
......@@ -76,7 +76,7 @@ export default class SIBRouter extends HTMLElement {
});
}
const id = resource ? resource['@id'] : null;
const path = route.getPath(this.prefix, routeName, id);
const path = route.getPath(this.prefix, routeName, route.hasAttribute('use-id') ? id : '');
if (!keepURL) {
//update current URL
const prefix = this.useHash ? '#' : '/';
......