I am trying to wrap my head around the following issue. In the root-level app.component you have the following structure:
<div class="container"> <sidebar /> <menu-bar /> <div class="h-full w-full overflow-auto"> <main class="overflow-auto"> <router-outlet></router-outlet> </main> </div> </div> The menu-bar is only used in some of the routes and even might change. Therefore I don't want to provide a specific implementation, but more or less:
<div class="container"> <sidebar /> <ng-container *ngComponentOutlet="..." /> <div class="h-full w-full overflow-auto"> <main class="overflow-auto"> <router-outlet></router-outlet> </main> </div> </div> This outlet should be provided by a child component (indirectly). The child component depends on the current route.
ASP.NET Blazor for example has a concept called SectionOutlet which describes exactly what I want:
Here the app.component.html:
<div class="container"> <sidebar /> <section-outlet SectionName="menu-bar" /> <div class="h-full w-full overflow-auto"> <main class="overflow-auto"> <router-outlet></router-outlet> </main> </div> </div> Now when I have a process page, this page can then easily provide the content: process-page.component.html:
<section-content SectionName="menu-bar"> <my-real-menu/> </section> <OtherContent/> What is the idiomatic way of doing this in Angular?