Repository navigation
Description
Which @angular/* package(s) are relevant/related to the feature request?
router
Description
When a complex Angular app with lazy-loaded routes has many possible routes that are connected, it is hard to define a PreloadingStrategy that does not pre-load too much while keeping the best User Experience / Performance.
Let's say if the courrent route is page /b12 and you can possibly navigate to /b1, /b2, /b3, ... plus /a1, /c1, /d1, /e1... for the best User Experience you might want to preload all those routes, but not routes like /a2, /a3,
This is a lot of routes to pre-load, lots of network requests, and makes the PreloadingStrategy implementation bloated.
The best compromise I have seen in fwks so far is SvelteKit's preload on hover where there is nothing to setup for users. In the previous example, it would mean zero pre-loading until the user hovers on of the connected links.
I am aware of the library ngx-hover-preload but it relies on either an Angular Module HoverPreloadModule or importing LinkDirective everywhere routerLink is used...
Would you consider including in Angular's default router apis a way to preload on hover?
Proposed solution
Propose a new PreloadingStrategy that supports preload on hover.
It would most likely involve a Service that is injected in the new PreloadOnHoverStrategy and optionally injected in RouterLink.
Alternatives considered
We can use ngx-hover-preload already, but not a fan of using modules in modern angular or repeating LinkDirective imports everywhere we are importing RouterLink.
We can also fork the RouterLink code and enhance it but that's very far from what we want, we highly value using Angular's default apis when we can.
Activity
SkyZeroZx commentedon Nov 18, 2026
I think this could be an opt in directive that injects
RouterLinkand triggers preloading on hover or focus. You’d only import it in the components that need it.Adding this directly to
RouterLinkcould increase bundle size for apps that don’t use the feature, depending on how it’s implemented.Eg:
atscott commentedon Nov 18, 2026
Right, I don’t think this can be something that’d be added to RouterLink due to bundle size impact. That said, I find the existing preloading strategy quite convoluted. A more straightforward method that preloads link’s target is something that’s planned as part of overall performance work
SkyZeroZx commentedon Nov 18, 2026
In fact, maybe in userland we could use the Speculation Rules API, which I think is better since is native from platform
See https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API
The only drawback is that it only works in Chromium-based browsers so far
Flarette commentedon Nov 19, 2026
You guys still prefetch onHover? That's soooo last month. My grandma just rewrote her app to pre-fetch on pre-hover: https://github.com/spaansba/ForesightJS
Something like this would be interesting as a preloading strategy