Content Projection (ng-content) သည် parent component မှ content ကို child component ထဲသို့ pass လုပ်ရန် အသုံးပြုသည်။
typescript
// card.component.ts
@Component({
selector: 'app-card',
template: `
<div class="card">
<div class="card-header">
<ng-content select="[header]"></ng-content>
</div>
<div class="card-body">
<ng-content></ng-content>
</div>
<div class="card-footer">
<ng-content select="[footer]"></ng-content>
</div>
</div>
`
})
export class CardComponent { }
// Usage in parent
<app-card>
<h2 header>Card Title</h2>
<p>This is the main content of the card.</p>
<button footer>Action</button>
</app-card>You should see
(Parent မှ pass လုပ်လိုက်သော content များသည် card component ၏ designated slots များတွင် ပေါ်လာမည်)