Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dateClick not emitted in fullcalendar angular

The dateClick event is not working, I did exactly as stated in the documentation:

https://fullcalendar.io/docs/angular

html:

    <full-calendar #calendar (dateClick)="alert('clicked')" defaultView="timeGridWeek"
        [nowIndicator]="true" [header]="header" [plugins]="calendarPlugins" [events]="[
          { title: 'event 1', start: '2019-05-22T13:00:00', textColor: 'white', end: '2019-05-22T14:00:00'  },
          { title: 'event 2', start: '2019-05-23T14:00:00', end: '2019-05-23T15:00:00' }
        ]"></full-calendar>

ts:

import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import listPlugin from '@fullcalendar/list';

  public calendarPlugins = [dayGridPlugin, timeGridPlugin, listPlugin];
like image 863
Luiz Ricardo Cardoso Avatar asked Dec 14 '22 11:12

Luiz Ricardo Cardoso


1 Answers

To solve this problem I did the following steps:

npm install --save @fullcalendar/interaction

I added the plugin's import into the component:

import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import listPlugin from '@fullcalendar/list';
import interactionPlugin from '@fullcalendar/interaction';

  public calendarPlugins = [dayGridPlugin, 
      timeGridPlugin, listPlugin , interactionPlugin];
like image 157
Luiz Ricardo Cardoso Avatar answered Jan 01 '23 18:01

Luiz Ricardo Cardoso