Accessing the fullcalendar object in Angular ui-calendar

I am trying to access the fullcalendar object in ui-calendar. The docs say that all I have to do is give the calendar attribute a name:

<div ui-calendar="calendarOptions" ng-model="eventSources" calendar="myCalendar"> 

Then you should have access to the calendar as such:

 uiCalendarConfig.calendars.myCalendar 

This does not work for me. The object I return is always empty. What I'm trying to ultimately do is programmatically switch the view. If I myself used only fullcalendar, I would do this:

 .fullCalendar( 'changeView', viewName ) 

How to do this using the ui-calendar directive?

Edit * My actual configuration object:

 $scope.uiConfig = { calendar:{ height: 700, editable: true, timezone:'America/Los Angeles', ignoreTimezone:false, header:{ left: 'month basicWeek basicDay agendaWeek agendaDay', center: 'title', right: 'today prev,next' }, eventDrop: $scope.onEventDrop, eventClick : $scope.onEventClick, eventResize : $scope.onEventResize, viewDisplay : $scope.onViewDisplay } }; 

My actual calendar:

 <div ui-calendar="uiConfig.calendar" ng-model="events" calendar="myCalendar"></div> 

My controller:

 app.controller('CalendarCtrl', function($scope, $http, $rootScope, uiCalendarConfig){ // bunch of methods plus $scope.uiConfig as shown above // console.log(uiCalendarConfig) outputs {} }); 
+5
source share
3 answers

Decision:

 $scope.myCalendar.fullCalendar('changeView', 'agendaDay' ); 

This is not like what the documentation instructs me. However, it solves my problem.

+5
source

Looking at the site: http://angular-ui.imtqy.com/ui-calendar/ , I found a solution.

You must add the uiCalendarConfig variable to your controller

 angular.module('clientApp').controller('ControllerCtrl', function ($scope, uiCalendarConfig) { ... } 

Add Calendar = "yourCalendarName"

 <div ui-calendar="uiConfig.calendar" ng-model="eventSources" class="calendar" calendar="yourCalendarName"> 

After that, you can start using the FullCalendar functions as follows:

 uiCalendarConfig.calendars.yourCalendarName.fullCalendar('unselect'); 
+5
source

Are you using bower with version 0.9.0-beta1? If so, consider question 195 .

As @jrzeznik suggested, a quick fix would be to overwrite calendar.js with the latest from the github repository.

0
source

Source: https://habr.com/ru/post/1209407/


All Articles