AngularJS UI-calendar not updating events on Calendar

前端 未结 11 2328
[愿得一人]
[愿得一人] 2020-12-10 04:52

I am using Angular UI-Calendar to show some events on the Calendar. The events are showing fine on the Calendar. But when I update any event\'s details, the event\'s detail

11条回答
  •  眼角桃花
    2020-12-10 05:23

    Try maintaining the same array instance.

    Instead of doing:

    $scope.events = []

    Try:

    $scope.events.slice(0, $scope.events.length);

    Then when your server request comes back, add each item individually to the existing array:

    for(var i = 0; i < newEvents.length; ++i) { $scope.events.push(newEvents[i]); }

    The reason I suggest this is because what you're describing sounds like the calendar might be holding onto the old list of events. The calendar might not know to update its reference, so instead, let it keep the same reference but change the contents of the array.

提交回复
热议问题