ng-repeat在ng-repeat中导致大量垃圾清理延迟

时间:2014-08-13 16:32:03

标签: javascript angularjs

我目前正在开发一个显示相对较大的数据表的项目。该表是100行乘23列,并使用ng-repeat内部的ng-repeat创建,如此

    <tr ng-repeat="domain in domains" once-class="selector-{{domain.selector}}" ng-class-odd="'zebra'">
        <td ng-repeat="column in columns" ng-switch="column.label" class="col{{$index}}">                                                                                                                                                                                <span ng-switch-when="bid" once-class="{ green: domain.maxbid > 0 }" class="button bid" ng-click="bidOnDomain(domain)">Bid</span>
            <span ng-switch-when="checkbox">
                <input type="checkbox" ng-checked="domain.checked" ng-model="domain.checked" ng-click="changeSelected()">
            </span>                                                                                                                                                                                                                                                      <span ng-switch-when="restore" class="button restore" ng-click="restoreDomain(domain)">Restore</span>
            <span ng-switch-when="CD" class="cd" ng-click="changeSelector()" ng-init="initCountDown()">
                {{ countDownText(domain) }}
            </span>                                                                                                                                                                                                                                                      <div ng-switch-when="MAX" class="max">
                $<input type="text" class="backorder_maxbid" ng-model="domain[column.key]" value="{{domain[column.key]}}">                                                                                                                                               </div>
                                                                                                                                                                                                                                                                     <span ng-switch-default ng-click="changeSelector()" once-text="domain[column.key]"></span>
        </td>                                                                                                                                                                                                                                            
    </tr>

(抱歉结构不好)

当我们尝试删除表并用来自不同页面的新数据替换它们时,会发生问题(因此,基本上是页面切换)。接下来是javascripts垃圾清理导致浏览器冻结2-3秒。

有更好的方法吗?是否存在(以指数方式?)存储在ng-repeats创建的范围内的信息?

谢谢:)

0 个答案:

没有答案