AngularJS性能 [英] Angularjs performance
问题描述
我有一个项目需要良好的性能,并显示大量记录.
I have a project that needs a good performance with a large number of records showed.
我的数据结构:
- 服务器(每页+-15)
- 网站(每台服务器+-20)
- 用户以您的状态登录(每个网站+-500)
- SERVERS (+- 15 per page)
- WEBSITES (+- 20 per server)
- USERS logged in with your STATUS (+- 500 per website)
对我的对象和控制器最好的方法是什么?
What is the best approach for my Objects and Controllers?
-
一个带有一个嵌套对象的控制器.
One Controller with one neasted object.
ServerCtrl-> $ scope.Server [0].网站[0].用户
ServerCtrl -> $scope.Server[0].Websites[0].Users
一个具有三个列表的控制器
One Controller with three lists
ServerCtrl-> $ scope.Servers; $ scope.网站; $ scope.Users
ServerCtrl -> $scope.Servers; $scope.Websites; $scope.Users
具有三个单独列表的三个控制器
Three Controllers with three separated lists
ServerCtrl-> $ scope.Servers
ServerCtrl -> $scope.Servers
网站Ctrl-> $ scope.网站
WebsiteCtrl -> $scope.Websites
UserCtrl-> $ scope.Users
UserCtrl -> $scope.Users
谢谢!
推荐答案
性能取决于您处理数据的方式. 因此,您可以使用AngularJS Batarang(Chrome扩展程序)并检查页面中的os watcher数量,并应用一些方法来减少此数量并为您的应用程序提供更高的性能. 小心大型列表和双向数据绑定,过滤器……它们是性能的恶棍.
The performance depends on how you manipulate the data. So you can use AngularJS Batarang (Chrome Extension) and check the number os watcher in your page and apply some methods to reduce this number and give more performance for your application. Be careful with big lists and two way data binding, filters... They're villains of performance.
这篇关于AngularJS性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- WEBSITES (+- 20 per server)
- 网站(每台服务器+-20)