Populate multiple placeholders in parent from child component in Angular4

Viewed 503

In my parent component I'm using a <router-outlet> which works fine to display the child html.

How can I allow the child to specify other parts of the parent component as well?

Here's what I've tried, but everything just gets rendered in the router-outlet placeholder.

Parent Component:

<header>
    ...
    <div #myheader></div>
</header>
<router-outlet></router-outlet>

Child Component:

<div #myheader> [Some HTML to be shown inside #myheader placeholder in parent] </div>
<div> [Rest of my html to be shown under router-outlet in parent</div>

The reason I need to do this is because the child component gets a lot of padding on either side, but the header runs full width, so it's not as simple as just specifying the child relative sub header in each child component.

1 Answers
Related