0

只有当我在小时或天属性中设置了 {{i}} 时,我才会收到此错误,请有人可以解释这种行为。

<td cell ng-repeat="j in [0,1,2,3,4,5,6,7]" hour="i" day="j"></td>

这是我的指令:

app.directive('cell', function(){
    return {
      scope : {
        "day":"=",
        "hour":"="
      },
  controller: WeekCtrl,
  link: function(scope,elm,attrs){

    // When using isolated scope and if we want to include parent scope variables we should define the controller. (I'm ok?)
    // When outside , in the element, we define day="{{i}}" an error about $digest overflow is produced, but with day="i" nothing happens

  }
}

});

提前致谢。

4

1 回答 1

1

这意味着您在传递数据时修改数据,这里:j in [0,1,2,3,4,5,6,7]。尝试类似的东西

<td cell ng-repeat="j in myArr=[0,1,2,3,4,5,6,7]" hour="i" day="j">
   <!--  myArr[j] = {{ myArr[j] }} -->
</td>

我在这里有同样的问题。

于 2013-06-16T05:30:03.757 回答