app-router
app-router copied to clipboard
Does app-router support dynamically created routes?
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?
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.