Angular #27 - Content Projection (ng-content)

Опубликовано: 02 Май 2026
на канале: Let's Build With Code
95
4

Click to watch Angular Playlist :    • Angular  

Content projection is a pattern in which you insert, or project, the content you want to use inside another component. For example, you could have a Card component that accepts content provided by another component.

The following sections describe common implementations of content projection in Angular, including:


CONTENT PROJECTION
Single-slot content projection: With this type of content projection, a component accepts content from a single source.

Multi-slot content projection: n this scenario, a component accepts content from multiple sources.

Conditional content projection: Components that use conditional content projection render content only when specific conditions are met.