RohitB97
RohitB97

Reputation: 450

eventClick in angular-ui-Calendar is not working

The UI works fine, the events are displayed correctly, but the only problem is eventClick isn't working. I thought jQuery needs to be updated to solve this issue, but I was wrong. There is something else which is preventing the eventClick from working! Please Help

This is my index.html

<div class="container">
<div ui-calendar='$ctrl.uiConfig.calendar' ng-model="$ctrl.eventSources">
</div>
</div>

this is my controller.js

(function(){

class CalendarComponent {
  constructor() {

    this.eventSources = [];

    this.uiConfig = {
       calendar : {
              editable : true,
              header : {
                        left : 'prev,next,today',
                        center : 'title',
                        right : 'month,agendaWeek,agendaDay'
                       }
                  },

          eventClick: function(event,jsEvent,view){
                       console.log("holla");
                      }
                };

  

   this.eventSources = [

          {
           events: [
                  {title: "finger painting", start: "2016-07-28T18:00+05:30", location: "SAC middle earth", allDay:false},
                  {title: "hand painting", start: "2016-07-27T21:30+05:30",location: "CLT", allDay:false}
               ],

           color: "red" 
          },

       {
          events: [
                  {title: "lightmusic", start: "2016-07-29T18:00+05:30", location: "OAT", allDay:false},
                  {title: "Rock music", start: "2016-07-28T21:30+05:30",location: "SAC middle earth", allDay:false}

              ],

              color: "blue"
             }

   ];             
       
                
  } 

 } 

angular.module('sangamApp')
  .component('calendar', {
    templateUrl: 'app/calendar/calendar.html',
    controller: CalendarComponent
  });

})();

Upvotes: 0

Views: 806

Answers (1)

Jay
Jay

Reputation: 1056

Try passing the uiConfig object to the ui-calendar, right now the eventClick isn't inside of the object that you're passing to that directive

Upvotes: 1

Related Questions