Angularjs Full Calendar doesn't display events

时光怂恿深爱的人放手 提交于 2019-12-02 08:00:04
Aniket Sinha

Here, in your eventSources you have entered the events directly.

What you should do is provide a list of arrays in which you have stored your events. Something like this: $scope.eventSources = [$scope.myEvents, $scope.someOtherArray, $scope.otherEvents];

and in $scope.myEvents, you can put your events.

$scope.myEvents = [
  {
    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.someOtherArray, $scope.otherEvents can be some other source for events.

As far as colors are concerned, you can customize them either through events object or event source object

$scope.someOtherArray = [];
$scope.weeklyEvents = {
    color: '#656565',
    textColor: 'white',
    events: []
};
$scope.otherEvents = {
    color: '#B2B2B2',
    textColor: 'black',
    events: []
};

You can modify your code to use either of the above two mentioned approaches(Visit those links).

What worked me is.

Instead of this.

$scope.eventSources = [$scope.myEvents, $scope.someOtherArray, $scope.otherEvents];

TRY THIS

$scope.eventSources.push($scope.myEvents);
Dav1011

I used

$scope.callCalendar = function (){
... ...
};

and in html file:

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

The events doesn't show up in the calendar; but I found the $scope.events has correct value in console.log($scope.events).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!