muaddoob
muaddoob

Reputation: 143

Set parent markup from nested child route component

I would like all of my routes' components to be nested in a BaseLayout component. This is easy for simple examples using router-outlet, where the entire child component is injected into the router-outlet. Is it possible define multiple places for a child to inject content into the parent? Similar to how named ng-content blocks work? I would like a child route component to be able to define content for header, main, and footer.

Upvotes: 0

Views: 396

Answers (1)

MartinHN
MartinHN

Reputation: 19772

The new docs for routing states:

A template may hold exactly one unnamed . The router supports multiple named outlets, a feature we'll cover in future.

So to make it work you'd add a name attribute on your <router-outlet name="aux"></router-outlet> and use that in your route config:

{path: '/chat', component: ChatCmp, outlet: 'aux'}

See more in this answer: https://stackoverflow.com/a/38096837/2972

Upvotes: 0

Related Questions