0

I know there are a few different answers out there that are similar, but I haven't found something exactly what I'm looking for.

See below.

app.component.html

<div id="main">
  <div id="sidepanel">
     <!-- update here -->
  </div>
  <div id="content">
     <router-outlet></router-outlet>
  </div>
</div>

The goal is that I'd like for a child page component (loaded by the router) to update the content in the side panel.

I know I could create a service, but I'd like to add HTML to the parent component directly. I guess I'm looking for something like how Asp.Net MVC/Razor allows you to specify multiple content blocks for the parent template.

Is this possible?

Thanks!

a11smiles
  • 1,190
  • 1
  • 9
  • 21
  • 1
    "I know I could create a service" - what's wrong with that ? – Eli Porush Nov 03 '22 at 06:27
  • You might looking for hand craft like this one: https://stackoverflow.com/a/58720658/11634381 – paranaaan Nov 03 '22 at 06:35
  • So the child route components should be able to set their "owned" template to the sidepanel area, is that correct? Sounds to me like in your case the `router-outlet` should be directly under `#main` div, so that the `#sidepanel` div gets set by each component as needed. – Fabian Strathaus Nov 03 '22 at 06:35
  • When you has a `` you has **no** children relationship. You should use a service with a subject – Eliseo Nov 03 '22 at 07:04
  • You could could use named router-outlet to project sidebar content based on the reoute. But anyway, what is wrong with shared service layer? – Antoniossss Nov 03 '22 at 07:27

0 Answers0