Explain how multi-slot content projection works with ng-content selectors.
Skip to solutionKEEP THE
mediumFrontend
What is standard content projection vs. Multi-Slot Content Projection?
1.0k views
01
Understand the problem
content-projection
02
Attempt it yourself
Sketch your approach before reading the solution — that's what interviews test.
Nudge consolestandby
Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.
03
Study the solution
Standard content projection renders all child tags inside <ng-content>. Multi-slot projection allows directing specific elements to specific slots using selectors on <ng-content select="[css-selector]"> (e.g., matching a class, tag, or attribute), ideal for card headers/footers.
Solution ready — 2 min read
Classified // press E to declassify
04
Read the code
Configuring a custom layout with Multi-Slot Content Projection
import { Component } from '@angular/core';
@Component({
selector: 'app-card',
standalone: true,
template: '<div class="card-container">' +
' <div class="header">' +
' <ng-content select="header, [card-header]"></ng-content>' +
' </div>' +
' <div class="body">' +
' <ng-content></ng-content>' +
' </div>' +
' <div class="footer">' +
' <ng-content select=".card-footer"></ng-content>' +
' </div>' +
'</div>'
})
export class CardComponent {}05
Join the discussion
Discussion (0)
Sign in to join the discussion.
No responses yet. Be the first to share what you think.
Transmission complete // awaiting log
KEEP THE
STREAK ALIVE.
Dossier 19 of 121 decoded in the Angular track. One more won't hurt.