javascript - AngularJS UI-calendar holding reference to old events -


I am using FullCalendar (angular-UI-Calendar) in an AngularJS application. I am passing an event using the Event Source array: $ scope.eventSources = [$ scope.events]; With $ scope.events being generated and updated by the Administrator. Whenever I update $ scope.events , then my trouble starts catching full calor in the context of the older versions. Index.html:

  & lt; Div ui-calendar = "uiConfig" ng-model = "event source" calendar = "mycalendar" & gt;  

My updated events function looks like this:

  public update events (new events) {// remove old events $ scope.events.splice ( 0, $ scope .events.length); // Add new events using push for push (var i = 0; i & lt; newEvents.length; i ++) {$ scope.events.push (new events [i]); Unfortunately, the above work does not get rid of the old events unless I make a clear call to refresh events from  EventSources  

< / P>
  $ scope.myCalendar.fullCalendar ('refetchEvents');  

I got a similar question (), and the answer to Studio 4 development seems most relevant. However, I think I am maintaining a single array example using push and splice.

I was going out of the library code tracing, only to realize that I was using the bower The established Angular-UI-Calendar was old. For some reason, the bower installs the version 0.8.1 by default, while 0.9.0-beta.1 is required for compatibility with Full Calendar v2. I was not able to reproduce this issue in plnkr because plnkr provides full calendars 1.6 by default, which is compatible with earlier versions of Cooner-U-Calendar.

Specifically, the function

  eventsWatcher.onRemoved = function (event) {scope.calendar.fullCalendar ('removeEvents', function (e) {return e == = Event;}); }; Updated  

  eventsWatcher.onRemoved = function (event) {scope.calendar.fullCalendar ('removeEvents', function (e) {return E ._id === event._id;}); };  

The old function is a full calendar filter that does not match anything due to the fact that FullSlaslander v2 adds some fields to each event (for example, a moment JS object).

TL; DR

Angular-U-Calendar did not refer to old programs, instead, it was not removing events correctly, updating in the latest beta releases resolves this problem.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -