Note: In Chrome Console, instead of document.querySelector
, you can use $0
- $4
to access the last 5 DOM elements selected in the inspector window.
var fooCtrl = angular.element(document.querySelector('[ng-controller*="fooCtrl"]')).scope();
angular.element(document.body).scope();
angular.element(document.body).isolateScope();
You have to select the element where ngApp
was defined.
var fooService = angular.element(document.body).injector().get('fooService');