app-router icon indicating copy to clipboard operation
app-router copied to clipboard

Does app-router support dynamically created routes?

Open araad opened this issue 9 years ago • 1 comments

I'm trying to include a "template repeat" to dynamically create routes, even though they are being rendered, they are not triggering any change when the url is changed.

<app-router core-animated-pages transitions="slide-from-right">
    <template repeat="{{section in sections}}">
        <app-route path="/{{section.name}}">
            <template>
                <p>{{section.name}}</p>
            </template>
        </app-route>
    </template>
</app-router>

Is that not supported?

araad avatar Apr 11 '15 20:04 araad

The <app-router> only looks for <app-route> elements that are direct children. https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L205-L211

It works this way in case there are multiple nested routers so that the outer router doesn't use inner router's routes.

erikringsmuth avatar Apr 12 '15 15:04 erikringsmuth