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

前端 未结 7 1667
醉话见心
醉话见心 2021-01-29 23:43

Is there a way of debugging the angularjs application when it is loaded in the browser?

ie. I wish to get the $rootScope of my current application. How woul

7条回答
  •  醉梦人生
    2021-01-30 00:38

    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) {
    
    }
    

提交回复
热议问题