这是 fiddle :
http://jsfiddle.net/D5h7H/7/
它呈现以下内容:
<div ng-repeat="group in Model.Groups">
<span>{{group.Name}}</span>
<div ng-repeat="filter in group.Filters">
<input type="checkbox" ng-model="filter.enabled">{{filter.Name}}
<select ng-disabled="!filter.enabled">
<option ng-repeat="value in filter.Values">{{value}}</option>
</select>
</div>
</div>
这是一个过滤器列表,这些过滤器从服务器加载到json中,然后呈现给用户(在示例中,在Fiddle中就生成了json)。目前有6组,每组30个过滤器,每个过滤器有15个选项元素。
在Firefox中,现在大约需要2秒钟才能重新绘制UI。
这次可以使用angular js吗?我做错了什么导致2秒的错误。渲染(因为2000个元素在我看来并不大,但是2秒肯定很大)?
最佳答案
在AngularJS 1.3+中,内置了 One-time binding
:
为了进行一次性绑定(bind),在::
之前添加绑定(bind)值:
<div>{{::name}}</div>
另请参阅相关讨论: