Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
index.js
readme.js
readme.styl
test.html
test.js

README.md

Router

The Router component will render its children components if the browser's current url matches its path property. This component will detect pushstate, popstate and replacestate events and re-render with the attributes of the url as props.

Demo

Example
/ /bar/100 /beepboop Hello, World number prop has the value . 404

Code

HTML

<tonic-router id="page1" path="/examples.html">
  <i>Hello, World</i>
</tonic-router>

<tonic-router id="page2" path="/bar/:number">
  <b>number</b> prop has the value <b id="page2-number"></b>.
</tonic-router>

<tonic-router none>404</tonic-router>

JS

%js%

Api

Properties

Property Type Description Default
path string A tokenized string to match against the current url, /books/:book for example.
none string If specified, and no matches have been made so far, this component will render.
id string If specified, provides a way to reference the component instance and listen for events on it.

Events

Name Description
match Emitted when a content section receives the show class because it matches the current url.