我正在使用转换为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,则日历将在具有所有信息时呈现。

我希望这可以帮助您

10-05 20:38
查看更多