>伙计们。
我对带有 angularJs 的 fullCalendar 有一些疑问。
我有配置全日历的代码:
.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'
}
}
};
});
加载到 URL 时如何根据完整日历显示发送月份 (AngularJs)
使用 viewRender 回调,您可以在其中访问实际显示的日期范围(start
和 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
}
};
});