簡體   English   中英

jQuery FullCalendar中未顯示的事件

[英]Events not displayed in jQuery FullCalendar

我正在使用轉換為AngularJS的jQuery FullCalendar,正在使用HTTP Request獲取事件,並且想要在日歷中顯示它們,將這些事件保存在插件事件對象中,但它們不會顯示在日歷中。

左側是我要在日歷中顯示的事件。

這是我用來保存通過HTTP請求獲得的事件的對象,數組$ scope.appointment_list包含我在左側列表中顯示的事件,日期采用插件建立的默認格式,但是我無法在日歷中顯示它們。

for(var i in $scope.appointments_list) {
    $scope.events.push({
        title: $scope.appointments_list[i].status,
        start: new Date($scope.appointments_list[i].date_start),
        end: new Date($scope.appointments_list[i].date_end),
        className: ['openSesame'],
        allDay: false,
        color: 'green',
        textColor: 'white',
        forceEventDuration: true
    });
}

日歷中可能會發生什么?

我有同樣的錯誤,我不知道為什么會發生。 但就我而言,要解決此錯誤,是在路由提供程序中創建一個url。 像這樣:

$routeProvider.when('/calendar/:somethingAjaxInfo', {
    templateUrl: 'calendar.html',
    controller: 'CalendarCtrl' });

並且在calendar.html中放入完整日歷的代碼。 當您與路由提供者發送郵件時,也在控制器中調用http請求

我認為問題是因為控制器在信息為空時嘗試調用http請求 ,但是如果在路由提供程序中執行url,則日歷將在具有所有信息時呈現。

我希望這可以幫助您

確保$scope.events對象傳遞給日歷的eventSources模型。 例如

<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>

在控制器中

$scope.events=[];
$scope.eventSources=[$scope.events];

讓我知道這是否不能解決您的問題。

還要檢查此答案https://stackoverflow.com/a/28239074/4510680

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM