DEV Community

Discussion on: Using ng-content for Content Projection

Collapse
 
anduser96 profile image
Andrei Gatej

You can also avoid unnecessary inserted DOM elements by using <ng-container> with ngProjectAs=“yourSelector”.

<app-comp>
  <ng-container ngProjectAs=“yourSelector”>
     <h3>title</h3>
     <article>content here</article>
  </ng-container>
</app-comp>
Collapse
 
deerawan profile image
Budi Irawan

oh nice! didn't know this before