I will first respond to dirty-checking, in the case of angular, once an object is bound to the scope, all values of the current state of the object are saved and the object is "tagged". At each cycle of $digest
, the angle checks the changes and replicates to all places that were referenced for the same variable in scope.
When you use the {{expressao}}
in the angle, what it does is mark this replacement position on the screen, so that after the $digest
cycle, if there is a change, it is applied to the expression.
As for EmberJS, it uses "change listeners" that do an analysis of the change only, not all of the objects demarcated in the scope, this brings a big gain in relation to the performance that I'm going to talk about below.
So, given the two concepts, what is the difference and what does it entail?
In the non-Angular case, all the attributes contained are compared to their respective original versions to tell if something has been changed or not, this is good in the aspect that everything has been verified, it is a comparison, it can not go wrong, for On the other hand, she is poor in performance. When a change is found, the angle will effectively trigger the event, indicating that it has been changed, and the listeners on the screen update.
In the case of EmberJs, a change triggers an event to update at specific points in the application, it is not necessary to check if something has changed since there is already a listener that is warned when this happens. This clearly implies a performance improvement. The issue here is in browser support, which is not always done the same way.
If you want to extend the question a little more, I'll leave this link which, besides explaining about the technique used in Angular and Ember, still explains about React: link