Angular · Junior · Question 28 of 75

What is <ng-content /> used for?

<!-- card.html -->
<div class="card"><ng-content /></div>

<!-- usage -->
<app-card><p>Any content</p></app-card>

Explanation

It is the Angular equivalent of children in React or slots in Vue. Several slots can be selected with <ng-content select="[card-title]" />.

Further reading

Problem with a question

Angular · Junior · question 28

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz