angular-ui / ui-calendar

A complete AngularJS directive for the Arshaw FullCalendar.
http://angular-ui.github.io/ui-calendar/
MIT License
1.49k stars 728 forks source link

Initial rendering incomplete inside of bootstrap tabs #283

Closed michael34 closed 9 years ago

michael34 commented 9 years ago

See this plunk: http://plnkr.co/edit/GeCcqmmuZC1fjCycdfS0?p=preview It doesn't render the calendar when inside of a tab until i click today. Workaround would be if you wrap the initialization in a $timeout

scope.init = function () { $timeout(function() { calendar.fullCalendar(options); }); if (attrs.calendar) { uiCalendarConfig.calendars[attrs.calendar] = calendar; } };

Not sure if this is a good solution...

mattoliver commented 9 years ago

this is actually a "feature" of fullcalendar: http://fullcalendar.io/docs/display/render/ "Notice that this example calls render whenever any tab is shown, not just the tab that the calendar is within. This is okay, because FullCalendar is smart enough to only render calendars that are visible to the user."

so if your calendar is created before your tab is visible then it won't render the events. I had to use a similar timeout function when I switched tabs because I was updating my events on a different tab.

michael34 commented 9 years ago

Oh Okay. Thanks.