I am using ui-calendar. I need to make a call to the server to retrieve all my events in order to display them on a calendar.
Here is what I do :
Controller:
vm.propositionsToCome = PropositionsAffairePresentationToCome.get(function(result){
for(var i = 0; i < result.length; i++)
{
$scope.events.push({title: 'test'+i,start: result[i].datePresentationPartenaire});
}
$scope.eventSources = [$scope.events]
uiCalendarConfig.calendars['myCalendar'].fullCalendar('refreshEvents');
});
$scope.uiConfig = {
calendar:{
height: 450,
editable: true,
header:{
left: 'title',
center: '',
right: 'today prev,next'
},
lang: 'fr'
}
};
$scope.eventSources = [$scope.events];
HTML :
div class="calendar" ng-model="events" calendar="myCalendar" config="uiConfig.calendar" ui-calendar="uiConfig.calendar"></div>
eventSources is well filled, when I display it in the view I am getting :
[[{"title":"test0","start":"2016-06-20T22:00:00.000Z","_id":1},{"title":"test1","start":"2016-06-20T22:00:00.000Z","_id":2}]]
But no events display on my calendar. I don't know how to refresh the calendar once I have loaded all my events from the server.
How can I do that?