我正在尝试访问 ui-calendar 中的 fullcalendar 对象。文档说我需要做的就是给日历属性一个名称:
<div ui-calendar="calendarOptions" ng-model="eventSources" calendar="myCalendar">
然后,您应该能够像这样访问日历:
uiCalendarConfig.calendars.myCalendar
这对我不起作用。我取回的对象总是空的。我最终想做的是以编程方式切换视图。如果我只使用 fullcalendar 本身,我会这样做:
.fullCalendar( 'changeView', viewName )
如何使用 ui-calendar 指令执行此操作?
编辑*我的实际配置对象:
$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
}
};
我的实际日历指令调用:
<div ui-calendar="uiConfig.calendar" ng-model="events" calendar="myCalendar"></div>
我的控制器:
app.controller('CalendarCtrl', function($scope, $http, $rootScope, uiCalendarConfig){
// bunch of methods plus $scope.uiConfig as shown above
// console.log(uiCalendarConfig) outputs {}
});