Search code examples
angularjsfullcalendarpopoverangular-ui

Angular-UI-Calendar: Open popup on calendar dayClick


I am using angular ui-calendar which has dayClick() function, which is working properly but when I am attaching popover code inside dayClick function, the popover is not opened.

I have got the solution for this, but it is working only with day/week not for agendaWeek or agendaDay

 $scope.onDayRender = function(date, cell) {
    console.log("### onDayRender");
    cell.popover({ content: "New Event: " + date });
}; 

Please give some solution for this to apply same for the agedaViews.


Solution

  • !!!Solution for AgendaViews!!! Just add the select option in your calendar config array.

    $scope.uiConfig = {
      calendar:{
        height: 500,
        editable: true,
        header:{
            left: 'prev,next',
            center: 'title',
            right: 'agendaDay agendaWeek'
        },
        select: function(start, end, allDay, jsEvent) {
            $scope.openPopover(start, end, allDay, jsEvent);
        }
      }
    };
    
    $scope.openPopover= function(start, end, allDay, jsEvent){
     $("#myPopover").popover('show');
    }
    

    Add a div with "myPopover" id in your HTML like:

    <div id="myPopover"></div>
    

    Its working fine for me.... :-)