Hey Ian, I think I've finally groked more-routing.
Rob's more-routing branch diff
<https://github.com/robdodson/contacts-app/compare/more-routing#diff-b9707fe88797285e93483456d1389b61>
on
his contacts-app made it click.
more-routing really feels like an extension of core-pages and
core-animaged-pages. The contacts-app index.html looks something like this.
<more-routing driver="hash"></more-routing>
<more-route-selector routes="['/add', '/contacts/:id', '/']"
selectedIndex="{{selected}}"
selectedParams="{{params}}"></more-route-selector>
<core-animated-pages selected="{{selected}}">
<section>
<add-page></add-page>
</section>
<section>
<info-page params="{{params}}"></info-page>
</section>
<section>
<contacts-page></contacts-page>
</section>
</core-animated-pages>
more-routing sits outside of core-animated-pages and coordinates which page
is selected given the defined routes and the current URL.
Looking at the docs, more-route-switch
<https://github.com/Polymore/more-routing#more-route-switch> feels like the
more natural way of expressing routes to me. What if you did something like
this that extends core-animaged-pages to achieve the same type of structure?
<core-animated-pages is="more-routing" driver="hash">
<section when-route="/add">
<add-page></add-page>
</section>
<section when-route="/contacts/:id" params="{{infoParams}}">
<info-page params="{{infoParams}}"></info-page>
</section>
<section when-route="/">
<contacts-page></contacts-page>
</section>
</core-animated-pages>
I did something similar to make app-router work with core-animated-pages
except in my case I wrap all of the routes in a <core-animated-pages> tag
hidden in the shadow DOM
https://erikringsmuth.github.io/app-router/#/core-animated-pages. I made an
app-router
fork of Rob's contacts-app
<https://github.com/erikringsmuth/contacts-app/compare/app-router#diff-b9707fe88797285e93483456d1389b61>
showing what it looks like.
I think just putting the route on the <section> for the active page rather
than outside in a <more-route-selector> tag would make it a lot more
intuitive. The fact that core-pages uses core-selector has seemed weird to
me all along. core-selector just doesn't feel like the right tool to build
a router. On the other hand, it's simple enough to hide the fact that it's
selecting pages using a selected="num" attribute.
-Erik
On Tuesday, November 11, 2014 10:35:27 AM UTC-6, Ian MacLeod wrote:
>
> Not entirely official, but I've been hacking at
> https://github.com/Polymore/more-routing as a more robust alternative for
> us. (we're still discussing whether we want something like this as
> core-routing, or whether we'd rather have several options to recommend).
>
> It's very alpha at the moment (potentially buggy and likely to have
> breaking changes) - but seems to show a lot of promise. I'd love to get
> some feedback on it as to where it has rough edges, particular when
> integrating with things like core-animated-pages.
>
> On Thu, Nov 6, 2014, 18:40 Erik Ringsmuth <[email protected]
> <javascript:>> wrote:
>
>> Is the Polymer team working on a core-router or is core-animated-pages
>> and flatiron-director as far as you're going right now? Would you be
>> interested in building something off a fork of app-router? I'm guessing
>> you'd have your Polymer way of doing things and tighter integration with
>> core-animated-pages. I think a lot of people in the Polymer community are
>> hoping for an official core-router. app-router is really just a hobby
>> project.
>>
>> 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] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/polymer-dev/d2ac5cee-584d-4c5f-9c41-f1943d245904%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/polymer-dev/d2ac5cee-584d-4c5f-9c41-f1943d245904%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
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/7b0b1ede-ea90-40fb-8094-d6f7b4b04640%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.