1

I am using http://angular-ui.github.io/bootstrap/ (version .10). I need to open a simple modal window on event click of full-calendar (http://arshaw.com/fullcalendar/).

I do that using

 select: function (start, end, allDay) {
                    console.log('Calendar select event fired');
                    var modalInstance = $modal.open({
                        templateUrl: 'template.html',
                        controller: function ($scope, $modalInstance) {
                            $scope.cancel = function () {
                                $modalInstance.dismiss('cancel');
                            };
                        },

                    });

This works first time and the modal opens and closes ok. However on 2nd click onwards the modal doesn't opens. The $modal.open is getting triggered and console shows no error.

The same exercise if it is done using ng-click works all time . This also need after writing a open function in controller.

<button class="btn btn-default" ng-click="open()">Open me!</button>

However my objective is to call the modal open from another directive using $modal.open.

What am I missing ?

appreciate your help.

Plunker Illustration here

Sumanta
  • 1,165
  • 4
  • 15
  • 25

1 Answers1

0

Try creating your controller function apart like

controller : 'sampleCtrl'

and then do:

var sampleCtrl=function(){}

Implement your functionality in this function, this will solve your problem.

prajmus
  • 3,171
  • 3
  • 31
  • 41
chetan
  • 1