Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular disable debugInfoEnabled

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);
}]);
like image 757
user1995781 Avatar asked Jun 03 '26 18:06

user1995781


1 Answers

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)
like image 76
tasseKATT Avatar answered Jun 06 '26 17:06

tasseKATT