The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Accessing Scope from The Console

Accessing Scope from The Console

1:40
The Chrome Dev Tools console is an amazing tool. In this lesson you'll learn how to use the console to programmatically grab scopes in your AngularJS application.
Watch this lesson now
Avatar
egghead.io

The Chrome Dev Tools console is an amazing tool. In this lesson you'll learn how to use the console to programmatically grab scopes in your AngularJS application.

Avatar
Reuben

I have always wanted to know how to do this. Thanks!

In reply to egghead.io
Avatar
Darijo

Chrome has extension for Angular, so you can observe scopes and relations between them more easily.

In reply to Reuben
Avatar
David

You can get $scope in chrome dev tools by installing Angularjs Batarang from the chrome web store. Thats pretty sweet too!

Avatar
Ramiro

anyone happen to know how to access the "controllers" scope when using controller as syntax? I can access the scope, but not the controller :)

Avatar
John

The "controller as" is simply on the scope, so get the scope, then scope.myController (or whatever you aliased your controller to).

In reply to Ramiro
Avatar
Michael

I think you can just use $scope w/o creating the var $scope = angular.element($0).scope() and it works the same.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?