Content Projection

Passing HTML into a child component, which shows it where `<ng-content />` is.

What is Content Projection?

Content projection lets a parent put its own content inside a child component, which shows it wherever it places <ng-content />. It is how you build reusable cards and dialogs.

<!-- card component template -->
<div class="card"><ng-content /></div>

<!-- using it -->
<app-card><h3>Weekly special</h3><p>Tacos, $5</p></app-card>

Level: Apprentice · More Angular terms at this level

Updated