Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in Web Technology by (47.6k points)

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 module myapp in the console as variables.

1 Answer

+2 votes
by (106k points)
edited by

To access the $scope variable in browser's console using AngularJS you should pick an element in the HTML panel of the developer tools and type this in the console see the code below:-

angular.element($0).scope()

Are you interested in learning Angularjs from the basics! Here's the right video for you on Angularjs provided by Intellipaat:

In browsers like WebKit and Firefox, $0 is a reference to the selected DOM node in the Elements tab, so by doing this, you get the selected DOM node scope printed out in the console.

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
2 answers

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...