Jolle Jolle - 1 year ago 82
AngularJS Question

AngularJS performance when using ng-repeat with big objects (not long arrays)

I just learned about $ here

It says that everything that is used in the view is monitored by angular. So I am wondering what happens when I am using an array containing big objects in a ng-repeat?

Say each object has an attribute: 'name', which is the only thing I use in the list. Will angular still look for changes in the whole object or just look at the 'name' attribute of each object?

Answer Source

AngularJS watches just that name property of objects because of showing on view. By the way, if those values which is name property don't need to be directly updated, you can use one-way data binding by adding :: before of variables. Like; ng-bind="". If you do this, AngularJS doesn't watch that variable of your object. Don't worry. If you update your array which contains all of this objects, AngularJS will update those name attributes because of updating array.

You can read this page of docs for one-way data binding.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download