You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feat] Investigate changing route component to a structural directive #37
It wraps the actual component, which might make it more difficult to style
Can't use display: none on the route element
This effort would look at potential options to use a structural directive to register the route, and have the route component rendered in its place with no wrapper.
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 --><routepath="/blog" [exact]="false"><app-blog></app-blog></route><routepath="/posts/:postId"><app-post></app-post></route><routepath="/about"><app-about></app-about></route><routepath="/" redirectTo="/blog"></route><routepath="/" [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 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.
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.
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.
Activity
LayZeeDK commentedon Jul 23, 2020
Maybe it could even be a structural directive on the
<router>element level, that is*routerinstead of<router>. This structural would be a responsible for managing the individual routed components.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.
meeroslav commentedon Aug 15, 2020
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: noneon route element? It does not render anything meaningful apart from being a wrapper to inner child component.LayZeeDK commentedon Aug 15, 2020
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.meeroslav commentedon Aug 15, 2020
In short - DOM rendering performance. I thought there was some specific use case in mind. Thanks for the clarification.