Comments (4)
what would be the use-case for using display: none on route element? It does not render anything meaningful apart from being a wrapper to inner child component.
The default for custom elements is display: inline;
, so there is a small cost to adding elements to the DOM, even empty elements. Angular components are hopelessly tied to the DOM. The DOM of a dynamic page gets slower the more visible elements are added because of memory consumption, render, layout, and paint.
from router.
From the ease of development and readability, I would vote for current functionality, over structural directives for router and route.
However, adding structural directives as an option would be great, unless we cripple the implementation by doing so.
I'll give it a go these days and see what comes out of it.
@LayZeeDK, @brandonroberts: what would be the use-case for using display: none
on route element? It does not render anything meaningful apart from being a wrapper to inner child component.
from router.
what would be the use-case for using display: none on route element? It does not render anything meaningful apart from being a wrapper to inner child component.
The default for custom elements is
display: inline;
, so there is a small cost to adding elements to the DOM, even empty elements. Angular components are hopelessly tied to the DOM. The DOM of a dynamic page gets slower the more visible elements are added because of memory consumption, render, layout, and paint.
In short - DOM rendering performance. I thought there was some specific use case in mind. Thanks for the clarification.
from router.
Maybe it could even be a structural directive on the <router>
element level, that is *router
instead of <router>
. This structural would be a responsible for managing the individual routed components.
<ng-container *router>
<!-- For nested routes use exact: false -->
<route path="/blog" [exact]="false">
<app-blog></app-blog>
</route>
<route path="/posts/:postId">
<app-post></app-post>
</route>
<route path="/about">
<app-about></app-about>
</route>
<route path="/" redirectTo="/blog"> </route>
<route path="/" [exact]="false">
<app-page-not-found></app-page-not-found>
</route>
</ng-container>
Not sure if this is possible. It would be a more complicated implementation, but it might be an easier developer experience to just apply one structural directive instead of one on each routed component.
from router.
Related Issues (20)
- [Docs] Add CONTRIBUTING.md
- [Question] RouteComponentDirective seems obsolete HOT 2
- [Feat] Provide access to all route params via router service
- [Feat] Sort routes by `path` and `exact` on registering
- [Feat] Enable route guards
- [Fix] Schematics folder has reference to `EffectsModule`
- [Refactor]: Clean up examples
- Explore integrating in an existing Angular Router application HOT 1
- Consider replacing `pathToRegexp` with built-in function HOT 3
- Lib: Bump Angular dependencies to a minimum of version 10
- Consider new name HOT 22
- usage in effects / ofRoute operator HOT 3
- [Bug]: linkTo directive makes / a relative link
- Lib: Remove query-string dependency in favor of URLSearchParams
- [Brand] Logo HOT 6
- feat: Rename Router Component
- feat: Support default exports
- feat: Explore support for Module Federation
- feat: Support loader function as input for route component HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from router.