Javascript &引用;“静态”;AngularJS中的属性

Javascript &引用;“静态”;AngularJS中的属性,javascript,angularjs,angularjs-directive,angularjs-ng-repeat,Javascript,Angularjs,Angularjs Directive,Angularjs Ng Repeat,我有一个指令,它使用ng repeat生成大量html输入[type=“radio”]。它们中的每一个都分配了许多属性 基本上: <div ng-repeat"day in days"> <label ng-repeat="slot in day.slots"> <input type="radio" class="{{slot.class}}" value="{{slot.value}}" ng-disabled="{{slot.disabled}}"

我有一个指令,它使用ng repeat生成大量html输入[type=“radio”]。它们中的每一个都分配了许多属性

基本上:

<div ng-repeat"day in days">
  <label ng-repeat="slot in day.slots">
    <input type="radio" class="{{slot.class}}" value="{{slot.value}}" ng-disabled="{{slot.disabled}}">
  </label>
</div>

问题是angular为每个输入元素的每个属性添加了一个观察者,这会消耗大量资源。如果
days
没有更改,则属性不会更改。有没有什么方法可以使属性保持静态,并且仍然使用ng repeat?或者我必须以其他方式生成模板?在这种情况下,当
days
发生变化时,我将如何执行此操作并仍让其重新渲染


更新:澄清它不仅仅是class属性

尝试使用
ng class

<input type="radio" ng-class="slot.class" />
您可以这样使用它:

<div shallow-watch="days">
    <div ng-repeat"day in days">
      <label ng-repeat="slot in day.slots">
        <input type="radio" class="{{slot.class}}" value="{{slot.value}}" ng-disabled="{{slot.disabled}}">
      </label>
    </div>
</div>

对不起。我不清楚我的整个问题,即每个输入元素都有许多属性。
<div shallow-watch="days">
    <div ng-repeat"day in days">
      <label ng-repeat="slot in day.slots">
        <input type="radio" class="{{slot.class}}" value="{{slot.value}}" ng-disabled="{{slot.disabled}}">
      </label>
    </div>
</div>