ui-calendar
ui-calendar copied to clipboard
Set calendar current date
How do you set the calendars current view date dynamically from controller. I want to be able to click a day in the month view and auto switch to that day in dayView.
+1
in the calendar ui config, attach the dayclick event:
dayClick: $scope.alertOnDayClick
in the event handler, you can switch view, and jump to the date:
$scope.alertOnDayClick = function (date, jsEvent, view, resource) { if (view.name !== 'month') return; uiCalendarConfig.calendars.myCalendar1.fullCalendar('changeView', 'agendaDay'); uiCalendarConfig.calendars.myCalendar1.fullCalendar('gotoDate', date ); }
myCalendar1 is the name of the calendar in the HTML:
<div class="calendar" ng-model="eventSources" calendar="myCalendar1" ui-calendar="uiConfig.calendar"></div>
Thanks Curtis Vayne. It works.