|
1 | 1 | /**
|
2 | 2 | * calendarDemoApp - 0.9.0
|
3 | 3 | */
|
4 |
| -angular.module('calendarDemoApp', ['ui.calendar', 'ui.bootstrap']); |
| 4 | +angular.module('calendarDemoApp', ['ui.calendar', 'ui.bootstrap']) |
| 5 | + .controller('CalendarCtrl', CalendarCtrl); |
5 | 6 |
|
6 |
| -function CalendarCtrl($scope,$compile,uiCalendarConfig) { |
| 7 | +function CalendarCtrl($scope, $compile, $timeout, uiCalendarConfig) { |
7 | 8 | var date = new Date();
|
8 | 9 | var d = date.getDate();
|
9 | 10 | var m = date.getMonth();
|
10 | 11 | var y = date.getFullYear();
|
11 |
| - |
| 12 | + |
12 | 13 | $scope.changeTo = 'Hungarian';
|
13 | 14 | /* event source that pulls from google.com */
|
14 | 15 | $scope.eventSource = {
|
@@ -37,7 +38,7 @@ function CalendarCtrl($scope,$compile,uiCalendarConfig) {
|
37 | 38 | $scope.calEventsExt = {
|
38 | 39 | color: '#f00',
|
39 | 40 | textColor: 'yellow',
|
40 |
| - events: [ |
| 41 | + events: [ |
41 | 42 | {type:'party',title: 'Lunch',start: new Date(y, m, d, 12, 0),end: new Date(y, m, d, 14, 0),allDay: false},
|
42 | 43 | {type:'party',title: 'Lunch 2',start: new Date(y, m, d, 12, 0),end: new Date(y, m, d, 14, 0),allDay: false},
|
43 | 44 | {type:'party',title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}
|
@@ -87,12 +88,14 @@ function CalendarCtrl($scope,$compile,uiCalendarConfig) {
|
87 | 88 | };
|
88 | 89 | /* Change View */
|
89 | 90 | $scope.renderCalender = function(calendar) {
|
90 |
| - if(uiCalendarConfig.calendars[calendar]){ |
91 |
| - uiCalendarConfig.calendars[calendar].fullCalendar('render'); |
92 |
| - } |
| 91 | + $timeout(function() { |
| 92 | + if(uiCalendarConfig.calendars[calendar]){ |
| 93 | + uiCalendarConfig.calendars[calendar].fullCalendar('render'); |
| 94 | + } |
| 95 | + }); |
93 | 96 | };
|
94 | 97 | /* Render Tooltip */
|
95 |
| - $scope.eventRender = function( event, element, view ) { |
| 98 | + $scope.eventRender = function( event, element, view ) { |
96 | 99 | element.attr({'tooltip': event.title,
|
97 | 100 | 'tooltip-append-to-body': true});
|
98 | 101 | $compile(element)($scope);
|
|
0 commit comments