Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2: How enable debugging in angular2 from browser console

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?

like image 920
Hitesh Kumar Avatar asked Oct 18 '22 18:10

Hitesh Kumar


1 Answers

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.

like image 75
Günter Zöchbauer Avatar answered Nov 11 '22 12:11

Günter Zöchbauer