erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
611 stars 83 forks source link

Add a new "defaultRoute" property to <app-router> #21

Closed jokesterfr closed 9 years ago

jokesterfr commented 9 years ago

see issue#20

erikringsmuth commented 9 years ago

I fixed the test cases for issue #20. I was missing a check when the pathType was set to hash.

For default routes I think it's simpler to set two routes that both point to the same custom element or template. For example, this does the same thing as defaultRoute.

<app-route path="/" import="/pages/home-page.html"></app-route>
<app-route path="/home" import="/pages/home-page.html"></app-route>

It's really two separate paths that just happen to point to the same page. You could also use a regular expression to match multiple paths.

jokesterfr commented 9 years ago

That's an elegant way to fix this, thank you :)