I have made a custom directive and a factory to control when to show and hide the calendar. When calendarFactory.isVisible
is set to true
, you call fullCalendar
's render function.
restrict: 'A',
scope: true,
link: function (scope, element, attrs) {
scope.$watch(function (scope) {
return calendarFactory.isVisible;
}, function (newValue, oldValue) {
if(newValue === true)
$(element).fullCalendar('render');
Code snippet is remade from production and might not be entirely correct, but the idea is. You should use $scope.$emit
and $scope.$on
instead of $watch
btw.
Solution #2 would be ui-calandar
I'm using it now for our own project and it can be nice for quick intergration, but I would suggest your own custom directive for flexibility. We do things like double calendar views, clientside localization, custom selection background-color, custom header for navigating multiple views.
If you need things like that, I suggest alternative #1.
And I really don't know how to write directives. So don't get discouraged! The hardest part will be getting FullCalendar to render dynamically.