How do I access the $scope variable in browser's console using AngularJS?

前端 未结 19 1688
渐次进展
渐次进展 2020-11-22 08:35

I would like to access my $scope variable in Chrome\'s JavaScript console. How do I do that?

I can neither see $scope nor the name of my mo

19条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 08:41

    At the Chrome's console :

     1. Select the **Elements** tab
     2. Select the element of your angular's scope. For instance, click on an element , or 
    , or etc. 3. Type the command **angular.element($0).scope()** with following variable in the angular's scope

    Example

    angular.element($0).scope().a
    angular.element($0).scope().b
    

    Chrome's console

提交回复
热议问题