Does DOM elements hide performance?

Suppose I have an HTML div containing numerous form elements that all look at model values โ€‹โ€‹if I use ng-show, ng-if or ng-switch on a div to hide it, does this angular JS stop the dirty check of form elements and therefore improve the performance of my application?

I suggest that if related elements are not visible, then there is no need for angular to check the values โ€‹โ€‹associated with them.

+4
source share
1 answer

ng-show and ng-hide only set the CSS display style and still handle the bindings. ng-switch , however, completely comments out cases that are not applied, which in turn means that the bindings in them are not handled. However, I agree with Edmondo1984's answer that I doubt that you should base your choice on this. Because of this, do not rewrite your ng-show as ng-switch es!

You can check this with the Chrome Batarang extension, the performance tab shows which clock is active.

+4
source

Source: https://habr.com/ru/post/1494028/


All Articles