I am building a calendar component, and I would like to provide the following API to users:
<fancy-calendar>
<my-custom-day [day]="day"></my-custom-day>
</fancy-calendar>
Where fancy-calendar
is responsible for keeping track of the current month that the user selects. Internally, I would like to implement it using something like *ngFor:
<div *ngFor="let day of daysInMonth">
<ng-content [day]="day"></ng-content>
</div>
This doesn't seem to work because ng-content
can't send arbitrary values (in this case, the current day.)
Do I need to write a custom directive for this? How can I give users the ability to use their own component for days?