Is there a way in Angular to project content from one component into a "container" in another component? Not from parent to child, which can be done with ng-content, but from a component to its cousin (via the parent).
In our application we have layout in the app component that splits the page into 3 elements: side menu, static header and main content panel.
Inside the content panel we've got router-outlet which renders content of the smart components. We wish to project some of that content to the header for example.
Below is very simplified example of the app structure. The difficulty is that different pages need to project vastly different contents, thus cannot easily be done by one, data-driven component.
We would like to avoid having a bunch of smart components conditionally referenced in the header and displayed based on what page is currently loaded in the main panel.
<app>
<side-menu>...</side-menu> <-- menu component
<header> <-- header component
<section>Static header content</section>
<section> ## Project content here ## </section>
</header>
<main>
<router-outlet></router-outlet> <-- page components
</main>
</app>
We tried looking into template outlet, but we couldn't wire up template defined in one component to the outlet in another.