Update events of calendar after page load

286 views Asked by At

My problem is that when I open the page, the events are loaded with a callback (function().then) and this cause my calendar to not load the events passed in $scope.eventSources

View

<div id="calendar" ui-calendar="uiConfig.calendar" calendar="myCalendar1" class="calendar" ng-model="eventSources"></div>

Controller

function LogisticaCtrl($scope, LogisticaService, $stateParams, $state, uiCalendarConfig) { 
    /* Event sources array */
    $scope.eventSources = {};

    /* config object */
    $scope.uiConfig = {
        calendar:{
            editable: true,
            header: {
                left: 'prev,next',
                center: 'title',
                right: 'month'
            }
        }
    };

    $scope.getLogistica = function(usu_seqreg) {        
        LogisticaService.GetLogistica(usu_seqreg)
        .then(function (logistica) {            
            $scope.logistica = logistica;  
            $scope.eventSources = logistica.events;             
        });
    }; 

    $scope.getLogistica($stateParams.usu_seqreg);  
} 

Angular version: 1.5
Fullcalendar version: v2.1.1
ui-calendar version: Unknown, but it seems like 1.0.0 (I compared the JS)

It is possible to load the events after? I tried some tricks but unsuccessful. The closest that I get was another function in the controller that destroy the calendar and recreate it in full javascript. But, even in this case, I need to execute this function with a button in the page.

0

There are 0 answers