Angular 清空数组后不更新

Angular does not update after emptying array

我有以下 HTML 其中第一行显示 :

<p>{{cal.eventSources}}</p>
<div ui-calendar ng-model="cal.eventSources"></div>

在我的 JS 中我有:

    $scope.$apply(setupCalendarEvents());

    function setupCalendarEvents(){

      self.eventSources = []; 

      angular.forEach(bookingMap, function(value, key) {
        self.eventSources.push(bookingMap[key]);
      });

    }

问题: 为什么第一行 HTML 更新但事件没有进入日历?

更多信息

如果我删除 self.eventSources = []; 行,那么事件就会出现在日历中,但显然每次我添加一个事件时,所有之前的事件都会被复制。

如果我删除 $scope.$apply(),则不会有任何更新。

我正在使用ui.calendar

所以事实证明,以下代码行切断了日历和模型之间的连接,因为它创建了一个新数组:

self.eventSources = []; 

相反,我将这一行替换为:

self.eventSources.length = 0;

我工作起来很有魅力。