how to debug the $rootScope object of angularjs in the browser

+1 for Batarang

Also, you can get the scope from any element in the DOM by executing the following from the console

angular.element(DOMNODE).scope()

Where DOMNODE, is of course, a reference to a DOM node.

For example, in Chrome in the elements tab you can select the node where the ng-app directive is, and get the root scope with

angular.element($0).scope()

In the developer console try this

$rootScope = angular.element(document).scope()

Batarang -- A Google Chrome plugin for AngularJS

After you installed this, you can do

console.log($rootScope);

and check the scope object in your chrome console.

BTW, if you want to get $rootScope, you need to inject to your controller

like

app.controller('MainCtrl', function($scope, $rootScope) {

}

For those using $compileProvider.debugInfoEnabled(false); and ng-strict-di just paste this in the console and $rootScope will be logged and added to window:

function getRootScope($rootScope){ console.log(window.$rootScope = $rootScope); }
getRootScope.$inject = ["$rootScope"];
angular.element(document.querySelector('[data-ng-app],[ng-app]')).injector().invoke(getRootScope);