Introducing aurelia router in multi page app - SOLVED

Hi!

We have a multi page app where we’ve started using Aurelia 1 for some dynamic content generation on each page.

We would like to start moving it towards being a SPA, starting by introducing the Aurelia router to handle some requests (we’ll convert the most central pages first), but let other requests pass through to the server.

I’m struggling a bit to find the right approach. It’s a huge app, so I would like to avoid having to apply router-ignore attributes to each link that it should let pass through up front. On the other hand, I can’t seem to find a nice way to tell the router to navigate directly to the URL. RouteConfig.redirect seems to only handle redirecting to another Aurelia handled fragment. If I do a instruction.router.navigate in the navigationStrategy and return null as moduleId, it will navigate to the correct page, but while that is loading, you’ll see the fallback route.

Any suggestions? Am I missing something?

Thanks in advance!

2 Likes

I found a solution: create my own LinkHandler implementation and use that to signal whether we should handle the click event in Aurelia or not.

2 Likes