I'm trying to style the selected day in a week view using angular-calendar.
From the docs, using dayHeaderClicked($event) it should be possible to add a cssClass property to $event.day, however, it does not seem to work for me.
My code looks like this:
setDate(day: WeekDay): void {
if (!day.isPast) {
this.viewDate = day.date;
this.requestForm.get('date').setValue(day.date);
if (this.previousDate) {
delete this.previousDate.cssClass;
}
day.cssClass = 'cal-day-selected';
console.log(day);
this.previousDate = day;
}
}
.cal-day-selected {
background-color: deeppink!important;
}
<mwl-calendar-week-view class="col-7" (dayHeaderClicked)="setDate($event.day)" [locale]="'es'"[viewDate]="viewDate">
</mwl-calendar-week-view>
The code is entering the if perfectly, the console.log(day) displays the object with the cssClass property but checking with the HTML inspector the class of the element doesn't change. I've tried using only $event as param and it does not work either.
This plunker accomplishes my goal but I can't seem to know why it works there and not in my project. Maybe library versions? I would really appreciate any insights.