Reputation: 179
guys.
i have some question about fullCalendar with angularJs.
i have code for config fullcalender :
.controller('MyController', function($scope) {
/* config object */
$scope.uiConfig = {
calendar:{
height: 450,
editable: true,
header:{
left: 'month basicWeek basicDay agendaWeek agendaDay',
center: 'title',
right: 'today prev,next'
}
}
};
});
how to send a month in accordance with fullcalendar display when loaded into a url (angularJs)
Upvotes: 0
Views: 298
Reputation: 3504
Use the viewRender callback, in which you can access the actually displayed date range (start
and end
)
.controller('MyController', function($scope, MyService) {
var eventSources;
var myCallbackFn = function(view, element){
var start = view.start;
var end = view.end;
// to get month only in format '01', '02' ... '12'
var dateFormat = 'MM';
var startMonth= start.format(dateFormat);
// then to load events you could use something like this
// just an example
MyService.getEvents(startMonth).then(function(response) {
eventSources = response;
});
}
/* config object */
$scope.uiConfig = {
calendar:{
height: 450,
editable: true,
header:{
left: 'month basicWeek basicDay agendaWeek agendaDay',
center: 'title',
right: 'today prev,next'
},
viewRender: myCallbackFn
}
};
});
Upvotes: 1