AngularJS:暂时禁用数据绑定。 [英] AngularJS: Temporarily disable data binding.
本文介绍了AngularJS:暂时禁用数据绑定。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以暂时禁用数据AngularJS绑定。我有一个列表项目
这是我使用渲染 NG-重复
。我想对项目
一些列表操作,而数据绑定暂时禁用,使中介更改不会在页面上体现,从而减缓下来。相反,我要在名单上执行的操作,然后重新启用数据绑定。
解决方案
VAR项目= angular.copy($ scope.items);
..
..
..
/ *执行过项目的操作* /
..
..
..
$ scope.items = angular.copy(项目);
Is it possible to temporarily disable data binding in AngularJS. I have a list items
which I render using ng-repeat
. I want to do some list operations on items
, while data-binding is temporarily disabled, so that the intermediary changes are not reflected on the page thereby slowing it down. Instead I want to perform the operations on the list and thereafter re-enable data binding.
解决方案
var items = angular.copy($scope.items);
..
..
..
/* perform operations over items */
..
..
..
$scope.items = angular.copy(items);
这篇关于AngularJS:暂时禁用数据绑定。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文