app-route
A modular client-side router
<app-route>
app-route
is an element that enables declarative, self-describing routing
for a web app.
See: Documentation, Large Demo, Simple Demo, Data Loading Demo.
Usage
Installation
npm install --save @polymer/app-route
In an HTML file
<html>
<head>
<script type="module">
import '@polymer/polymer/lib/elements/dom-bind.js';
import '@polymer/app-route/app-location.js';
import '@polymer/app-route/app-route.js';
</script>
</head>
<body>
<dom-bind>
<template>
<app-location route="{{route}}"></app-location>
<app-route
route="{{route}}"
pattern="/:page"
data="{{routeData}}"
tail="{{subroute}}">
</app-route>
<app-route
route="{{subroute}}"
pattern="/:id"
data="{{subrouteData}}">
</app-route>
</template>
</dom-bind>
</body>
</html>
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/app-route/app-location.js';
import '@polymer/app-route/app-route.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<app-location route="{{route}}"></app-location>
<app-route
route="{{route}}"
pattern="/:page"
data="{{routeData}}"
tail="{{subroute}}">
</app-route>
<app-route
route="{{subroute}}"
pattern="/:id"
data="{{subrouteData}}">
</app-route>
`;
}
}
customElements.define('sample-element', SampleElement);
Contributing
If you want to send a PR to this element, here are the instructions for running the tests and demo locally:
Installation
git clone https://github.com/PolymerElements/app-route
cd app-route
npm install
npm install -g polymer-cli
Running the demo locally
polymer serve --npm
open http://127.0.0.1:<port>/demo/index.html
open http://127.0.0.1:<port>/demo/simple-demo.html
open http://127.0.0.1:<port>/demo/data-loading-demo.html
Running the tests
polymer test --npm
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Dependencies
- @polymer/iron-location#^3.0.0-pre.26
- @polymer/polymer#^3.0.0
- Released
- 2018-09-14
- Maturity
- IMPORTED
- License
- BSD 3-clause "New" or "Revised" License
Compatibility
- Framework
- Polymer 1.0+
- Polymer 3.0+
- Polymer 2.0+ in 2.1.2
- Browser
- Browser Independent
app-route - Vaadin Add-on Directory
A modular client-side routerOnline Demo
Documentation
GitHub Homepage
Issue tracker
License
View on GitHub
app-route version 0.8.0
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.0
app-route version 0.8.1
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.0
app-route version 0.8.2
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.0
app-route version 0.8.3
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.0
app-route version 0.8.4
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 0.8.5
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 0.9.0
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 0.9.1
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 0.9.2
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 0.9.3
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 1.0.0
### Dependencies
* polymer#polymer/polymer#^1.3.1
* iron-location#polymerelements/iron-location#^0.8.1
app-route version 1.0.1
### Dependencies
* polymer#Polymer/polymer#^1.3.1
* iron-location#PolymerElements/iron-location#^0.8.1
app-route version 2.0.0
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 2.0.1
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 2.0.2
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 3.0.0-pre.1
### Dependencies
* @polymer/iron-location#^3.0.0-pre.1
* @polymer/polymer#^3.0.0-pre.1
app-route version 2.0.3
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 3.0.0-pre.2
### Dependencies
* @polymer/iron-location#^3.0.0-pre.1
* @polymer/polymer#^3.0.0-pre.1
app-route version 3.0.0-pre.4
### Dependencies
* @polymer/iron-location#^3.0.0-pre.4
* @polymer/polymer#^3.0.0-pre.4
app-route version 3.0.0-pre.6
### Dependencies
* @polymer/iron-location#^3.0.0-pre.6
* @polymer/polymer#^3.0.0-pre.6
app-route version 3.0.0-pre.7
### Dependencies
* @polymer/iron-location#^3.0.0-pre.7
* @polymer/polymer#^3.0.0-pre.7
app-route version 3.0.0-pre.8
### Dependencies
* @polymer/iron-location#^3.0.0-pre.7
* @polymer/polymer#^3.0.0-pre.7
app-route version 3.0.0-pre.10
### Dependencies
* @polymer/iron-location#^3.0.0-pre.10
* @polymer/polymer#^3.0.0-pre.10
app-route version 2.1.0
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 3.0.0-pre.11
### Dependencies
* @polymer/iron-location#^3.0.0-pre.10
* @polymer/polymer#^3.0.0-pre.10
app-route version 3.0.0-pre.12
### Dependencies
* @polymer/iron-location#3.0.0-pre.12
* @polymer/polymer#3.0.0-pre.12
app-route version 3.0.0-pre.13
### Dependencies
* @polymer/iron-location#^3.0.0-pre.13
* @polymer/polymer#^3.0.0-pre.13
app-route version 3.0.0-pre.14
### Dependencies
* @polymer/iron-location#^3.0.0-pre.14
* @polymer/polymer#^3.0.0-pre.13
app-route version 3.0.0-pre.15
### Dependencies
* @polymer/iron-location#^3.0.0-pre.15
* @polymer/polymer#^3.0.0-pre.13
app-route version 3.0.0-pre.16
### Dependencies
* @polymer/iron-location#^3.0.0-pre.16
* @polymer/polymer#^3.0.0-pre.13
app-route version 2.1.1
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 3.0.0-pre.17
### Dependencies
* @polymer/iron-location#^3.0.0-pre.17
* @polymer/polymer#^3.0.0-pre.13
app-route version 3.0.0-pre.18
### Dependencies
* @polymer/iron-location#^3.0.0-pre.18
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.19
### Dependencies
* @polymer/iron-location#^3.0.0-pre.19
* @polymer/polymer#^3.0.0
app-route version 2.1.2
### Dependencies
* iron-location#PolymerElements/iron-location#1 - 2
* polymer#Polymer/polymer#1.9 - 2
app-route version 3.0.0-pre.20
### Dependencies
* @polymer/iron-location#^3.0.0-pre.20
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.21
### Dependencies
* @polymer/iron-location#^3.0.0-pre.21
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.22
### Dependencies
* @polymer/iron-location#^3.0.0-pre.20
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.23
### Dependencies
* @polymer/iron-location#^3.0.0-pre.22
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.24
### Dependencies
* @polymer/iron-location#^3.0.0-pre.22
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.25
### Dependencies
* @polymer/iron-location#^3.0.0-pre.24
* @polymer/polymer#^3.0.0
app-route version 3.0.0-pre.26
### Dependencies
* @polymer/iron-location#^3.0.0-pre.25
* @polymer/polymer#^3.0.0
app-route version 3.0.0
### Dependencies
* @polymer/iron-location#^3.0.0-pre.26
* @polymer/polymer#^3.0.0
app-route version 3.0.1
### Dependencies
* @polymer/iron-location#^3.0.0-pre.26
* @polymer/polymer#^3.0.0
app-route version 3.0.2
### Dependencies
* @polymer/iron-location#^3.0.0-pre.26
* @polymer/polymer#^3.0.0