angularjs - Using FullCalendar methods with AngularUI wrapper -


i'm trying integrate angularui's calendar wrapper application, , calendar initialization works fine. however, don't see how can call calendar methods here. here's controller code:

$scope.events = []; $scope.calendaroptions = {     calendar: {         header: {             left: 'prev,next today',             center: 'title',             right: 'month,agendaweek,agendaday'         },         defaultview: 'agendaweek',         selectable: true,         selecthelper: true,         select: function(start, end, allday) {             var title = prompt('event title:');             if (title) {                 $scope.$apply(function(){                     $scope.events.push({                         title: title,                         start: start,                         end: end,                         allday: allday                     });                 });              }             // should call 'unselect' method here         },         editable: true     } }; $scope.eventsources = [$scope.events]; 

how call methods calendar? it's not in controller's scope, i've checked everywhere inside scope object.

i found inside uicalendar directive code:

 scope: {ngmodel:'=',config:'='}, 

by understanding, means calendar created in isolated scope. no methods can called on calendar. however, in demo found line:

 /* change view */ $scope.changeview = function(view) {     $scope.mycalendar.fullcalendar('changeview',view); }; 

so demo can call methods on calendar , can't? can't replicate either.

any understanding or fixing issue appreciated.

okay, pretty obvious in source code, didn't understand on first glance. here's relevant snippet:

if(attrs.calendar){     scope.calendar = scope.$parent[attrs.calendar] = elm.html(''); }else{     scope.calendar = elm.html(''); } 

this binds calendar parent scope under name declare when write calendar directive in html. e.g.

<div ui-calendar="options" calendar="my-calendar-name" ng-model="events"></div> 

this means can call on calendar's methods in controller's scope. feature implementation hadn't considered yet! need docs script.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

html - Building a fluid horizontal navigation -