Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have been using Fullcalender directive in angularjs application. As I have been in the documentation there is double click handle exists in Fullcalender jquery plugin.

Here is the ref: http://code.google.com/p/fullcalendar/issues/detail?id=375#makechanges

There is a suggestion for the double click is that we should used eventRedner event handler for registering double event. As I did and got succeed but the problem is I wont be able to call $modal box inside bind method.

Here is the code.

$scope.eventPopup = function(event,element){
    console.log($scope);

    element.bind('dblclick', function(e) {
        console.log("double click" );
        var modalInstance = $modal.open({
            templateUrl: Drupal.settings.angularjsApp.basePath + '/ng_node/calender/popup',
            controller: ModalInstanceCtrl,
            scope: $scope
        });
    });
};

Calender configuration:

$scope.uiConfig = {
    calendar:{
        height: 450,
        editable: true,
        eventStartEditable: false,
        header:{
            left: 'prev,next today',
            center: 'title',
            right: 'month,basicWeek,basicDay'
        },
        //eventClick: $scope.alertOnEventClick,
        eventDrop: $scope.alertOnDrop,
        eventResize: $scope.alertOnResize,
        eventRender: $scope.eventPopup

    }
};

Can any one suggest me what should I do?

Thanks

share|improve this question
    
Can you show in jsfiddle ? –  jQuery.PHP.Magento.com Jul 10 '14 at 10:56
    
I have never used jsfiddle. But you want I can send you code for that reason. Problem is that in jQuery bind method I am unable to use Angular scope variable. Even though I have console.log (window) object I can access. Please advice if you know how to traverse angular scope variable via Window object –  MSK Jul 10 '14 at 11:51

1 Answer 1

up vote 2 down vote accepted

I have resolved that issue by using $apply() method in AngularJs.

element.bind('dblclick',function(e) {

        $scope.$apply(function(){
            console.log(event_date._d);
            var modalInstance = $modal.open({
                templateUrl: Drupal.settings.angularjsApp.basePath + '/ng_node/calender/popup',
                controller: ModalInstanceCtrl,
                resolve:{
                    day: function (){
                        return event_date._d;
                    }
                },
                size: 'lg',
                scope: $scope
            });
        });

    });

$apply() function is used for jQuery binding.

Thanks

share|improve this answer
    
You now have to accept your own answer. –  Chnossos Jul 11 '14 at 22:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.