How $compileProvider.debugInfoEnabled set to false

2019-04-06 02:30发布

问题:

I read the the documentation from angular website about debugInfoEnabled. Still doesn't clear with concept, how $compileProvider.debugInfoEnabled(false) inside angular config can improve the performance of application by removing the element level class (angular-directives) binding such as ng-scope and ng-isolated-scope.

Does anyone know, how performance boost can happen by setting up debugInfoEnabled to false in $compileProvider? Can anyone help me to clear out my concept about angular $compileProvider.debugInfoEnabled feature of angular 1.3?

Any Help would appreciated, Thanks in advance:)

回答1:

These classes that are added to your DOM elements are directives (directive can be elements, attributes, classes, or comments).

When angular is compiling the DOM and hits a directive it then runs through that directives logic to change, manipulate, update, or do whatever task it is that the directive is asking angular to do.

For example it will take your ng-repeat directives and build out multiple DOM elements accordingly.

By removing these directives (classes like ng-scope & ng-isolated-scope) angular will not stop at these locations and execute logic. Because of this the performance increase is achieved.