Here's my element that implements routing with
Polymer<https://github.com/ahuth/app-router>,
and I could use your help looking over it.
Using it, you can set up routes:
<app-router target="#main">
<app-route to="index">/</app-route>
<app-route to="contact">/contacts/:id</app-route>
</app-router>
Right now, this will dispatch a change-route event, along with any url
parameters.
You can also setup views:
<app-views>
<template name="index">
<p>This is the index</p>
</template>
<template name="contact"
<p>This is contact number {{ id }}</p>
</template>
</app-views>
These views will get loaded into whatever is specified by the target
attribute on the app-router when the corresponding route is activated. In
this example, {{ id }} will also get swapped out for the id url parameter.
What do you guys think about this approach? I like having routes nested
under the router. I *don't* like, however, having views on the page. Not
sure if there's another way, though.
Also, to get variables into the 'views', I abuse innerHTML and regex's,
which probably isn't a great idea. These are my first polymer elements,
though, so any pointers on how to make them more Polymeric would be greatly
appreciated. The docs are also a work in progress.
Finally, I haven't published these, because I'm not sure how to package
them up. There's really 3 separate polymer elements here. They just happen
to work well together.
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/478461c7-e192-4834-909a-4381f8b4f62b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.