As a newcomer to Angular, I am working on creating a datepicker with a customized header. I have successfully passed a custom header for the mat-calendar component. Reference: https://material.angular.io/components/datepicker/overview#customizing-the-calendar-header
However, I am facing an issue where I need to show the current active Date's month in the header.
**.html
{{ monthLabel }}
**.ts
monthLabel = this.getMonthLabel()
months = ['Jan','Feb','Mar','Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dev'];
private getMonthLabel(){
return this.months[this.dateAdapter.getMonth(this.calendar.activeDate)];
}
Whenever a user selects a different month in the datepicker, the monthLabel does not update. How can I solve this problem using | async
? If anyone could offer guidance on achieving this, it would be greatly appreciated.