AngularJS Debugging Getting the Scope of element


Example

In an angular app everything goes around scope, if we could get an elements scope then it is easy to debug the angular app. How to access the scope of element:

angular.element(myDomElement).scope();
e.g.
angular.element(document.getElementById('yourElementId')).scope()  //accessing by ID

Getting the scope of the controller:-

 angular.element('[ng-controller=ctrl]').scope()

Another easy way to access a DOM element from the console (as jm mentioned) is to click on it in the 'elements' tab, and it automatically gets stored as $0.

angular.element($0).scope();