Aneeez
Aneeez

Reputation: 1452

Angular - FullCalendar dateClick not working

I'm using FullCalendar version 4.4.0. dayClick event is not getting triggered in my code. My code is as follows.

calendar.component.html

<full-calendar
defaultView="dayGridMonth"
[plugins]="calendarPlugins"
[events]="calendarEvents"
eventColor= '#6236ff'
eventBorderColor= '#6236ff'
eventTextColor='#ffffff'
(dateClick)="handleDateClick($event)"
></full-calendar>

calendar.component.ts

handleDateClick(event){
  console.log("day", event);
}

When I click on the date, nothing happens. The event isn't logged into the console.

Upvotes: 1

Views: 1579

Answers (1)

Alireza Ahmadi
Alireza Ahmadi

Reputation: 9903

You need to add interactionPlugin to calendarPlugins

calendarPlugins = [dayGridPlugin, timeGrigPlugin, interactionPlugin];

Here is working sample I wrote for you: https://stackblitz.com/edit/fullcalendar-angular-example-ebmz5j?file=src%2Fapp%2Fapp.component.ts

Upvotes: 3

Related Questions