6

In AngularJS, we have a function called reloadWithDebugInfo()

angular.reloadWithDebugInfo()

which reload the current application with debug information turned on. One can execute this function in browser console and enable the debugging. I am looking for it's equivalent in Angular 2 which can let us enable debugging in developer console. But it seems like there's no equivalent function of this which can be accessed in the browser console. I know there are functions like enableDebugTools and disableDebugTools which let us enable and disable the debugging but one can not access them in browser console. And also to get access to angular2's debugging weapons like ng & ng.probe, one has to enable debug tools first as written in the Angular 2 Application Debugging Guide:

Make sure your application has production mode disabled so that you can have access to the all the methods described below.

I just want to know Is there any way to enable debug tool using console in Angular 2?

1 Answer 1

4

Debugging info is enabled by default during development in Angular2.

Debugging tools need to be enabled with enableDebugTools

For production enableProdMode() should be called to get rid of debug information that slows down your application and increases code size.

For details how to access debug info from the console see how to access Angular2 component specific data in console?

https://augury.angular.io/ provides a browser Plugin with a graphical UI

Because an Angular application is built for deployment, the options need to be enabled when the application is built, otherwise it won't be included in the deployable.

Sign up to request clarification or add additional context in comments.

4 Comments

How do I enable debugging in production once it is disabled.
You don't. You need to build it with debugging enabled. You need to actually enable it as you mentioned in your question (I was to update my answer but Chrome crashed). If your application is built with debugging disabled, there is no debugging information included in your deployable.
So we can not enable debugging in production. One has to rebuild with debugging enabled and then deploy. Makes sense. Thanks.
Yes, that's my understanding.

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.