const redirect = (from, to, next) => next({ redirect: 'new' });
router.mapRoutes([ { route: 'old', before: redirect } ]);
const preventExit = (from, to, next) => next(??? ? null : 'home')
router.mapRoutes([ { route: '', name: 'home' ]);
router.before = [preventExit];
router.buildTitle = (instructions) => instructions.reverse().map(i => i.title).join(' | ');
Use case:
A dynamically loaded component has configureRouter and router-view
some developers would like to generate events on child routers
https://github.com/aurelia/router/issues/293
a case to look and test for with child router and redirect params
https://github.com/aurelia/router/issues/66
Use case
generate route to a sibling router
https://github.com/aurelia/router/issues/89
Cancelling a navigation instruction with a redirect raises inconsistent navigation events
https://github.com/aurelia/router/issues/177
Links containing hash anchor tags in URL not supported
https://github.com/aurelia/router/issues/225
Add helpers for dynamically matching paths
https://github.com/aurelia/router/issues/249
Load route viewModel module from external location or via alternative resolve strategy
https://github.com/aurelia/router/issues/379
Re https://github.com/aurelia/router/issues/379
Commenting here because that issue was closed, but it would be a wishlist item for a backport...
Similar to how globalResources lets you pass the constructor for a resource now instead of the module path,
It would be great if you could pass an async function to the route config that resolves to the viewmodel constructor (ie container key?) to use for the route.
We are trying to avoid things breaking due to moved or renamed modules, and this is one of the last areas in our app where a string is still required.
Being able to pass a function that returns (await import("module-path")).ViewModelX would allow the build to catch errors (or the IDE to do the refactoring).
That's a wonderful idea, thank you for the note.
On Thu, Apr 25, 2019, 20:17 Kris Dages notifications@github.com wrote:
Re aurelia/router#379 https://github.com/aurelia/router/issues/379
Commenting here because that issue was closed, but it would be a wishlist
item for a backport...Similar to how globalResources lets you pass the constructor for a
resource now instead of the module path,It would be great if you could pass an async function to the route config
that resolves to the viewmodel constructor (ie container key?) to use for
the route.We are trying to avoid things breaking due to moved or renamed modules,
and this is one of the last areas in our app where a string is still
required.Being able to pass a function that returns (await import
("module-path")).ViewModelX would allow the build to catch errors (or the
IDE to do the refactoring).—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/aurelia/aurelia/issues/239#issuecomment-486881806,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA5K5P3KZS666S565VBGRGTPSJC2NANCNFSM4F6JC6WQ
.
Most helpful comment
Use case
generate route to a sibling router
https://github.com/aurelia/router/issues/89