0Pricing
Angular Academy · Lesson

Single-Slot Content Projection

Project content with ng-content.

What Is Content Projection?

Content projection lets a component receive markup from its parent and render it inside its own template. It is Angular's equivalent of "slots" in web components.

The parent writes content between the component's tags, and the component decides where that content appears.

Why You Need It

Reusable wrappers like cards, dialogs, and panels do not know their content ahead of time. Content projection makes them flexible containers.

  • Build a card once, fill it with anything
  • Keep layout logic in the component
  • Keep content in the consumer

All lessons in this course

  1. Single-Slot Content Projection
  2. Multi-Slot Projection with select
  3. ng-template and ng-container
  4. TemplateRef and ViewContainerRef
← Back to Angular Academy