There seems to be a problem with event rendering in the calendar. Even though eventSources is correctly populated with Angular, it doesn't show the events. According to Fullcalendar documentation at http://fullcalendar.io/docs/event_data/Event_Source_Object/ , the form seems to be correct and no errors are returned.
On the we page we have just the calendar:
Contents of $scope.eventSources:
[
{
"events": [
{
"id": "562e65c5fb0cc1110a6ea143",
"title": "Test event 2",
"start": "2015-10-15T15:00:00.000Z",
"end": "2015-10-20T12:00:00.000Z",
"description": "Second event for testing the system",
"allDay": false
},
{
"id": "562e65c5fb0cc1110a6ea144",
"title": "Test event 3",
"start": "2015-11-01T09:00:00.000Z",
"end": "2015-11-08T12:00:00.000Z",
"description": "Third event for testing the system",
"allDay": false
},
{
"id": "562e65c5fb0cc1110a6ea142",
"title": "Test event 1",
"start": "2016-01-01T09:00:00.000Z",
"end": "2016-01-01T12:00:00.000Z",
"description": "First event for testing the system",
"allDay": false
}
]
}
]
Angular version is 1.2.1. Has anyone seen anything similar and has been able to solve it?
EDIT: Apparently in my case as I was async fetching the events it didn't pick up the changes to the events. A quick fix (a hacky one at that), change line#101 in src/calendar.js to:
var array = angular.isFunction(arraySource) ? arraySource() : $scope.eventSources;
as this will link to the actual model reference instead of a copy (I believe)
OK, I found a solution : the problem comes from demo documentation which is not compatible with last version of fullcalendar.
In fullcalendar documentation : http://fullcalendar.io/docs/event_data/events_array/ they exmplain that using eventSources require "to write things a little differently" :
$('#calendar').fullCalendar({
eventSources: [
// your event source
{
events: [ // put the array in the `events` property
{
title : 'event1',
start : '2010-01-01'
},
{
title : 'event2',
start : '2010-01-05',
end : '2010-01-07'
},
{
title : 'event3',
start : '2010-01-09T12:30:00',
}
],
color: 'black', // an option!
textColor: 'yellow' // an option!
}
// any other event sources...
]
});
Writing the eventSource in my ng-model this way solved the problem of event rendering for me.
// initialization of eventSources
this.eventSources = [];
[...]
// loading events
this.eventSources.push({events : this.currentCalendar.days}); // this.currentCalendar.days is an array of objects containing title and start date.
// initialization of eventSources
this.eventSources = [];
[...]
// loading events
this.eventSources.push({events : this.currentCalendar.days}); // this.currentCalendar.days is an array of objects containing title and start date.
@eduardonunesp I'm having the same problem as yours, it works when I have at least one event, but when I don't have events and I try to push the first one, it doesn't render. Could you please tell me how did you solve this issue?
If this was addressed to me I have moved on from this code and am
implementing all things calender through web components, polymer
specifically.
The problems I have had with angular UI components almost all revolved
around the jquery lite implementation being run where full jquery was
needed.
Look at the loading order of jquery and angular ui on your booting web page.
On Mon, Oct 10, 2016 at 11:40 PM, Ricardo Camacho notifications@github.com
wrote:
@eduardonunesp https://github.com/eduardonunesp I'm having the same
problem as yours, it works when I have at least one event, but when I don't
have events and I try to push the first one, it doesn't render. How did you
solve this issue?
@eduardonunesp @ricardocamacho I had that same problem after updating fullcalendar to v3.0.1, using angular v.1.5.8.
Solved it by regressing fullcalendar to v.2.7.1.
@bostondevin did you have to do anything special to get the calendar to render when using ng-if? When I do that, the calendar just doesn't render at all even after the condition is satisfied.
Hi,
There seems to be a problem with event rendering in the calendar. Even though eventSources is correctly populated with Angular, it doesn't show the events. According to Fullcalendar documentation at http://fullcalendar.io/docs/event_data/Event_Source_Object/ , the form seems to be correct and no errors are returned.
On the we page we have just the calendar:
Oh, forgot about HTML tags. Here's the div again:
+1, same problem. angular version 1.4.7
+1, same problem. also angular version 1.4.7
EDIT: Apparently in my case as I was async fetching the events it didn't pick up the changes to the events. A quick fix (a hacky one at that), change line#101 in src/calendar.js to:
as this will link to the actual model reference instead of a copy (I believe)
same problem with branch "angular-1.3.x" and angular 1.3.14.
Also tested with master branch and angular 1.3.14, same problem: events are not rendered.
OK, I found a solution : the problem comes from demo documentation which is not compatible with last version of fullcalendar. In fullcalendar documentation : http://fullcalendar.io/docs/event_data/events_array/ they exmplain that using eventSources require "to write things a little differently" :
Writing the eventSource in my ng-model this way solved the problem of event rendering for me.
Dear Mathilde,
I see what you are saying but even sitting here looking at it it is a bit to cryptic for me.
Are you injecting this as a function event source bound to $scope in the the controller??
If you could paste in how you implemented this in the context of the angular.controller it would be very helpful.
Thanks
I have a directive with a template containing these lines:
And in my controller, I have :
Thanks
Hi Mathilde,
I ended up with two big problems:
I was loading jquery before angular and that screws up the use of the internal jquery:lite that angular-io uses for calendar and other apps big time
and for some stupid reason I was setting the html element:attribute to ' ngModel="eventSources" ' instead of ' ng-model="eventSources" '
As you can tell I am just getting started with this! 😀
Thank you for your help
I will now continue to muddle on throught.
On Thu, Nov 12, 2015 at 2:19 AM, Mathilde Pellerin <notifications@github.com
Cloid John Green
Same here, when passing objects like:
But if have one event at least it works:
Only the second one is rendered
@mathilde-pellerin thanks!
@eduardonunesp I'm having the same problem as yours, it works when I have at least one event, but when I don't have events and I try to push the first one, it doesn't render. Could you please tell me how did you solve this issue?
If this was addressed to me I have moved on from this code and am implementing all things calender through web components, polymer specifically.
The problems I have had with angular UI components almost all revolved around the jquery lite implementation being run where full jquery was needed.
Look at the loading order of jquery and angular ui on your booting web page.
On Mon, Oct 10, 2016 at 11:40 PM, Ricardo Camacho notifications@github.com wrote:
Name: Cloid John Green Phone: 612 819-4363 EMail: cloidjgreen@gmail.com
@eduardonunesp @ricardocamacho I had that same problem after updating fullcalendar to v3.0.1, using angular v.1.5.8. Solved it by regressing fullcalendar to v.2.7.1.
I solved it simply by doing an ng-if - it needs to wait til the data is there
<div ui-calendar ng-model="eventSources" ng-if="eventSources.length > 0"></div>
@bostondevin it worked ,Thanks
@bostondevin did you have to do anything special to get the calendar to render when using ng-if? When I do that, the calendar just doesn't render at all even after the condition is satisfied.