nekken / ng2-fullcalendar

95 stars 47 forks source link

How to use eventClick? #30

Open AlbertoFCasarrubias opened 7 years ago

AlbertoFCasarrubias commented 7 years ago

I have probles with eventclick, can anyone help me?

this.calendarOptions = { height: 'parent', fixedWeekCount : false, firstDay: 1, defaultView: 'agendaWeek', locale: 'es', editable: true, eventLimit: true, // allow "more" link when too many events events: [], eventClick: function(event) { console.log(event); this.showConsulta(event); } };

And the function showConsulta(event) { console.log(event) }

This I can see on the console, but I get that the function doesn't exist

My goal is to call a function in any event

shah-smit commented 7 years ago

Why are you putting eventClick into Calendar options?

According to the documentation, you are supposed to use any event click in the following manner.

$('#calendar').fullCalendar({
    eventClick: function(calEvent, jsEvent, view) {

        alert('Event: ' + calEvent.title);
        alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
        alert('View: ' + view.name);

        // change the border color just for fun
        $(this).css('border-color', 'red');

    }
});