【发布时间】:2017-07-02 02:45:31
【问题描述】:
我正在使用 https://github.com/angular-ui/ui-calendar 在 Angularjs 中使用 FullCalendar。
它显示日历并且没有错误;
<div class="calendar" ng-model="eventSources" id="eventCalendar" calendar="calendar" config="uiConfig.calendar" ui-calendar="uiConfig.calendar"></div>
但它不会显示事件,我不确定我是否做得对,但它没有显示错误,我通过互联网搜索并没有找到解决方案。谁能给我一个提示为什么它不起作用?
这里是sn-p的代码:
var calApp = angular.module('usercalapp', ['ui.bootstrap','dialogs','ngCookies','ui.calendar']);
calApp.controller('UserCtrl', function ($scope, $http, $rootScope, $timeout,,$dialogs,$cookieStore,$compile,uiCalendarConfig)
{
$scope.eventSources = [];
$scope.calendar = $('#calendar');
$scope.uiConfig = {
calendar : {
height: 450,
editable: true,
header: {
left: 'month basicWeek basicDay',
center: 'title',
right: 'today prev, next'
},
dayClick: $scope.alertEventOnClick,
eventDrop: $scope.alertOnDrop,
eventResize: $scope.alertOnSize
}
};
$scope.cal_func = function()
{
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$scope.eventSources = [
{
title: 'All Day Test Event',
start: new Date(y, m, 1)
},
{
title: 'Long Test Event',
start: new Date(y, m, d - 5),
end: new Date(y, m, d - 2)
},
{
title: 'Test Birthday Party',
start: new Date(y, m, d + 1, 19, 0),
end: new Date(y, m, d + 1, 22, 30),
allDay: false
}];
$scope.calendar.fullCalendar('refetchEvents');
};
$scope.showColorPicker = function(index)
{
$cookieStore.showuserid = index;
dlg = $dialogs.create('/dialogs/pickColor.html','pickColorCtrl',{},{key:false ,back:'static'});
dlg.result.then(function()
{
$scope.cal_func();
});
};
....
所以我希望用户选择一种颜色,然后日历中应该会显示 3 个事件,但没有任何反应...
【问题讨论】:
标签: javascript angularjs fullcalendar