Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Change Detection and list references

Tags:

angular-dart

Does it matter to Angular if in every digest cycle I return a new list with the same contents vs returning the same list instance? This is assuming default change detection, not OnPush.

like image 572
Dandan Avatar asked Nov 08 '22 23:11

Dandan


1 Answers

It will have some impact - ngFor will need to reevaluate each of the elements - it will do identity check. That should be quick, but if you have thousands elements in a big app it may add some overhead, so if you can it's better to return the same list each time.

like image 169
rkj Avatar answered Jan 04 '23 02:01

rkj