erikringsmuth / app-router

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

Better support for dynamically adding routes - in nested routers #129

Open juicyarts opened 9 years ago

juicyarts commented 9 years ago

Im having some issues with nested app-routers.

In my application i have a main router which initializes the main route with a wildcard:

This router gets populated by an Array of a Polymer-Element thats wrapped around the router and initializes manually via 'router.init()` int the elements ready function and init="manual" on the router element.

The Path that lies underneath initializes a nested app-router that needs to be populated dynamically too. There are no errors but it seems like app router doesn't resolve the dynamic routes in the nested router.

so something like this:

<some-custom-element>
 <app-router  id="a" init="manual">
   <template is="dom-repeat">
    <app-route path="/:aId/landing/*" import="some-other-custom-element"> <!-- this one is populated properly -->
    <some-other-custom-element>
     <app-router ="b" init="manual">
      <template is="dom-repeat">
      <app-route path="/:aId/landing/static" import="static-element"> <!-- this one looks like its populated but the route wont return the needed import element -->
...

to test if there is an implementation error i cloned one of these dynamic nested routes and hard coded it into the nested router. When i do that everything works, so there must be an issue with the manual initialization of nested routes i think. Do you have any experience with this kind of issue or can you help me solve this?

The project im working on is available here : https://github.com/juicyarts/wbm-polymer/tree/develop

juicyarts commented 9 years ago

i managed to get it working by setting a Timeout but to me that doesn't seem to be the best approach to solve this issue.