简体   繁体   English

如何在 angularjs 中避免大量观察者

[英]How to avoid a lot of watchers in angularjs

I am running an application that is using tables,inside table is at least 900 square.Every square contains data and when user clicks on the square he/she can change this data,so as I googled it I need watchers to change data dynamically and update view immediately.我正在运行一个使用表格的应用程序,表格内至少有 900 个正方形。每个正方形都包含数据,当用户点击正方形时,他/她可以更改这些数据,因此当我搜索它时,我需要观察者动态更改数据和立即更新视图。 I have read a lot about - how to work big data with angularjs but everyone write that you must show less information and then load more if user needs it,but I have to show this whole table.Because so many watchers,my program's one page works slowly.I already spent a lot of time to find solution but no result,please someone give me advice.thank you.我已经阅读了很多关于 - 如何使用 angularjs 处理大数据,但每个人都写道,如果用户需要,您必须显示更少的信息,然后加载更多信息,但我必须显示整个表格。因为有这么多观察者,我的程序只有一页工作缓慢。我已经花了很多时间找到解决方案但没有结果,请有人给我建议。谢谢。

这可能会有所帮助,每次绑定{{someobject.property}}类的东西 angular 都会创建一个观察者来保持该出价更新,因此首先,确定您的表中是否有用户无法与之交互的内容并将其绑定{{::someobject.property}} (一种方式绑定)可以为您节省一些观察者,因为 angular 不会处理该属性,请考虑按需加载数据,而不是加载整个表,很多东西但是, 一个͟t͟i͟m͟e͟数据绑定将使您开始获得更好的性能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM