我正在使用 Angularjs 日历 UI 来创建事件调度程序日历。最初日历是隐藏的,在切换开关时它会显示出来。但是在按下下个月或上个月按钮之前不会呈现日历。
app.controller('toggleController', [ '$scope', function($scope) {
$scope.toggleSelection = function toggleSelection(event) {
angular.element(document.querySelectorAll('.calendar-container')).css({display:'block'});
};
}]);
所以我想从日历 ui 控制器调用渲染函数,以便从上面的控制器在切换视图上渲染它
app.controller('CalendarCtrl', ['$scope','$rootScope', function($scope, $compile, $timeout, uiCalendarConfig) {
/* Change View */
$scope.renderCalendar = function(calendar) {
$timeout(function() {
if(uiCalendarConfig.calendars[calendar]){
uiCalendarConfig.calendars[calendar].fullCalendar('render');
}
});
};
}]);
我尝试使用调用 renderCalendar 函数,$rootscope
但出现以下错误
$timeout not defined
或uiCalendarConfig not defined
等