Rearchitect Router so it's more modular
See original GitHub issueWhich @angular/* package(s) are relevant/releated to the feature request?
router
Description
The Angular router’s current architecture is problematic for a couple big reasons:
- It is not extensible. Developers cannot easily extend or change the Router’s functionality to support features that would be useful to their applications. Instead, these features have to be built in to the core Router code and exposed through some endpoint (i.e.
RouteReuseStrategy
, some option onExtraOptions
which is used as an switch in the internal code, etc.) - It is not tree shakeable. Due to its non-modular nature, almost all features (lazy loading, guards, resolvers) are generally baked in to the Router’s internals unless explicitly configurable through a
Strategy
that can provide ano-op
implementation. Simple applications that do not use these features still incur the bundle size cost.
Proposed solution
Because of the above two problems, we’re often quite limited on what features we can implement. The router should be rearchitected with the following goals in mind:
- Tree-shakeability
- More configurable features, such as
- General ability to use @angular/router to build custom routing solutions, which will likely require exposing more of the router internals such as:
Alternatives considered
N/A
Issue Analytics
- State:
- Created 2 years ago
- Reactions:133
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Rearchitect the Data Center Through Fully Modular Design
For this type of data center, time to market could be more than 20 months. In addition to its long lead time, the...
Read more >RE: Virtual Router Specific Config - Extreme Networks - 25934
A couple of issues/questions: 1) it seems that it is very difficult to identify virtual router-specific config. For example - if I go...
Read more >Better Express Routing & Architecture for Node.js
So for this post, I'm going to talk about how to write a more modular, extensible, testable, and scalable implementation of your routing....
Read more >Pioneering the IP and Optical Transformation - Cisco
Communication service providers (CSPs) are working to balance their need to ... Figure 5 – Routing Line Card Bandwidth Enabled by Optical Pluggable...
Read more >How to refactor / re-architect the components/state here in ui ...
module ('routerApp', ['ui.router', 'feed']); routerApp.config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise('/login ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any news on this? Would be really great to have more flexibilty with the router, especially to change the execution order of guards and resolvers as its often nearly impossible use them both in conjucation as it should be
@micru It’s on our radar and I’m trying to slowly chip away at some smaller complexities in the router that would make this more difficult to accomplish. Some of these items include #45735, #45240, #45877. Special cases and unpredictability in how the
Router
internals operate make it harder to expose swappable parts because it’s harder to match the expectations or even know what those are.There’s no additional information at the moment though. We haven’t started work on taking a deep dive into what APIs we want to make pluggable.