What is the purpose of ng-content in Angular?
<ng-content> is used for content projection, i.e., to pass custom content into a
component from a parent.
Example:
<!-- alert.component.html -->
<div class="alert-box">
<ng-content></ng-content>
</div>
Usage:
<app-alert>
<p>Warning! Something went wrong.</p>
</app-alert>
Real-Time Example:
Reusable modal or alert components that display different messages using
<ng-content>.