Angularjs 性能 [英] Angularjs performance
问题描述
我有一个项目需要良好的性能并显示大量记录.
I have a project that needs a good performance with a large number of records showed.
我的数据结构:
- 服务器(每页 +- 15 个)
- 网站(每台服务器 +- 20 个)
- 使用您的状态登录的用户(每个网站 +- 500)
我的对象和控制器的最佳方法是什么?
What is the best approach for my Objects and Controllers?
一个控制器和一个嵌套对象.
One Controller with one neasted object.
ServerCtrl -> $scope.Server[0].Websites[0].Users
ServerCtrl -> $scope.Server[0].Websites[0].Users
一个控制器和三个列表
ServerCtrl -> $scope.Servers;$scope.Websites;$scope.Users
ServerCtrl -> $scope.Servers; $scope.Websites; $scope.Users
具有三个分隔列表的三个控制器
Three Controllers with three separated lists
ServerCtrl -> $scope.Servers
ServerCtrl -> $scope.Servers
WebsiteCtrl -> $scope.Websites
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屋!
- 网站(每台服务器 +- 20 个)