Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Angular JavaScript Code

I am working on a proof of concept using Angular JavaScript.

How to debug the Angular JavaScript code in different browsers (Firefox and Chrome) ?

like image 898
AskQuestion Avatar asked Sep 13 '13 08:09

AskQuestion


People also ask

Can we Debug JavaScript?

But fortunately, all modern browsers have a built-in JavaScript debugger. Built-in debuggers can be turned on and off, forcing errors to be reported to the user. With a debugger, you can also set breakpoints (places where code execution can be stopped), and examine variables while the code is executing.

How do I Debug AngularJS in Firefox?

1) Install Firebug. Look on the Script tag, find your controller in the scripts that the page loads. Find your $scope values. Set watches on them.


1 Answers

1. Chrome

For debugging AngularJS in Chrome you can use AngularJS Batarang. (From recent reviews on the plugin it seems like AngularJS Batarang is no longer being maintained. Tested in various versions of Chrome and it does not work.)

Here is the the link for a description and demo: Introduction of Angular JS Batarang

Download Chrome plugin from here: Chrome plugin for debugging AngularJS

You can also use ng-inspect for debugging angular.

2. Firefox

For Firefox with the help of Firebug you can debug the code.

Also use this Firefox Add-Ons: AngScope: Add-ons for Firefox (Not official extension by AngularJS Team)

3. Debugging AngularJS

Check the Link: Debugging AngularJS

like image 68
Vaibhav Jain Avatar answered Nov 10 '22 02:11

Vaibhav Jain