3

I am trying to disable debug info by putting $compileProvider.debugInfoEnabled(false); in angular.config(). But why is that when I check in the chrome browser, I can still see the number of watchers with angular watchers plugin. It feels like the debug info is not disabled.

How can I disable it?

Example of my working code:

angular.module('app.core.config', [])
.config(['$compileProvider', function ($compileProvider) {
    // disable debug info
    $compileProvider.debugInfoEnabled(false);
}]);
6
  • What value are you getting when you run angular.element(document.querySelector('body')).scope() in your console? Commented Dec 8, 2015 at 4:50
  • @ShashankAgrawal I get n {$id: 2, $$childTail: b, $$childHead: b, $$prevSibling: null, $$nextSibling: null…} Commented Dec 8, 2015 at 5:36
  • Okay, can you please give me the link of the angular watchers plugin you are using? Commented Dec 8, 2015 at 5:46
  • @ShashankAgrawal Here is the link chrome.google.com/webstore/detail/angular-watchers/… Commented Dec 8, 2015 at 5:51
  • 1
    That seems to working fine for me. Can you please add your code that how are you disabling the debug info and which version of Angular you are using? Commented Dec 8, 2015 at 5:57

1 Answer 1

5

It's because Ionic overrides the default behavior:

/**
 * @private
 * Parts of Ionic requires that $scope data is attached to the element.
 * We do not want to disable adding $scope data to the $element when
 * $compileProvider.debugInfoEnabled(false) is used.
 */
IonicModule.config(['$provide', function($provide) {
  $provide.decorator('$compile', ['$delegate', function($compile) {
     $compile.$$addScopeInfo = function $$addScopeInfo($element, scope, isolated, noTemplate) {
       var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
       $element.data(dataName, scope);
     };
     return $compile;
  }]);
}]);

If you inject the $compile service you can inspect it and see that $$addScopeInfo is not the noop function as it usually is when debug info is disabled:

$$addBindingClass: noop()
$$addBindingInfo: noop()
$$addScopeClass: noop()
$$addScopeInfo: $$addScopeInfo($element, scope, isolated, noTemplate)
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot for your answer. So, is that mean the debug info is not disabled with Ionic? Meaning, with or without debugInfoEnabled(false) makes no different?
At least that part of the debug info is still available in Ionic. I'm not sure if Ionic overrides every behavior of debugInfoEnabled(false). You can for example check if the classses ng-scope and ng-binding are available or not on your elements in the DOM. Usually they are only added if debug info is enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.