简体   繁体   中英

Static scope in angular.js

in my app I'm showing a big table of data. And as always I'm saving all the data i need to display in the $scope variable.

The problem is, with that much data in the DOM and also being watched by angulars digest loop the site lags a lot. Because I'm just showing static data, that can't be manipulated i would like to have a static scope that can not be manipulated on that very view and performs better.

So my question is, is there something like $scopestatic ?

Your performance problem most likely comes from too many data bindings. If it's only static data, you need to get rid of that.

I suggest you use a directive instead, creating DOM elements from your data. You only need to do it once and your website should perform much better without so many useless bindings.

What you actually need should be bindonce

Another problem may be that showing a big table directly to user sounds like a bad idea. Human brain can not process too many datas. We can filter or paginate them for user instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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