Skip to main content

What is Content Projection and why do we use it?

Junior Angular
Quick Answer Content projection (ng-content) lets a parent component pass markup into a child component's template. The child template defines placeholder where injected content appears. Useful for creating flexible wrapper components (cards, modals, tabs) that don't know their content in advance. Multi-slot projection: projects only elements with class "header".

Answer

Content projection allows inserting external content into a component's template.

It enables reusable UI wrappers, flexible layouts, and component composition.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice