Blog
Contact

Configuring an AngularJS app for production

Michael Prentice
Sep 14, 2016

When running in production mode, your app should do the following:

myApp.config([
  '$compileProvider',
  '$logProvider',
  function ($compileProvider, $logProvider) {
    $compileProvider.debugInfoEnabled(false);
    $logProvider.debugEnabled(false);
  },
]);

Note that this is in addition to whatever else your app needs to do in its .config() function. For this to be fully effective, you should use Angular’s $log service instead of console.log() throughout your app.

As Ben Nadel noted, if your app is doing element.scope() anywhere, it will no longer work after $compileProvider.debugInfoEnabled(false) is called.

AngularJS Logo

Michael Prentice
Sep 14, 2016