Change detection and immutable states

The problem we ealluded to in our previous recipe is inherent to any framework that maps some sort of view and model. It isn't an Angular particularity. That being said, this problem, while exacerbated within loops, also exists in other places. To be precise, it exists everywhere we bind everything between our models and out the view. In other words, every time we have {{ myValue }} somewhere in our HTML model, it is a performance hit for our application.

So, what is the solution? Stop using binding altogether? Well, that would not be very practical, as we would give up on what makes JavaScript attractive in the first place. No, the real solution is to make our objects immutable. However, to understand ...

Get Angular Design Patterns now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.