8

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:)

Claies
  • 22,124
  • 4
  • 53
  • 77
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299

1 Answers1

13

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.

Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
Jacob Carter
  • 711
  • 5
  • 12
  • No problemo, my pleasure – Jacob Carter Jan 17 '15 at 18:57
  • That means angular $compileProvider.debugInfoEnabled(false) only don't bind ng-scope & ng-isolated-scope. That's all? – Pankaj Parkar Jan 17 '15 at 19:02
  • From Angular website: > Where the compiler has created a new scope, the scope and either ng-scope or ng-isolated-scope CSS class are attached to the corresponding element – Jacob Carter Jan 17 '15 at 19:06
  • I read from angular documentation, and i mentioned the same in my question.I asked you, this is the only thing $compileProvider.debugInfoEnabled(false) does? – Pankaj Parkar Jan 17 '15 at 19:09
  • 1
    To my knowledge yes, considering your entire Angular application contains many many different scopes, this is actually quite a bit that it is doing. You can see just how many levels of sibling and nested scopes exist in your application by using the chrome extension Batarang – Jacob Carter Jan 17 '15 at 19:11
  • Thanks Jacob for your valuable time – Pankaj Parkar Jan 17 '15 at 19:14
  • 1
    Perhaps worth mentioning this excerpt from the [docs](https://docs.angularjs.org/guide/production) : **Tools like Protractor and Batarang need this information to run ..** – Robin-Hoodie Mar 30 '16 at 11:52