Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save OzieWest/87010684d392c2c8470b to your computer and use it in GitHub Desktop.

Select an option

Save OzieWest/87010684d392c2c8470b to your computer and use it in GitHub Desktop.
Debugging AngularJS Apps from the Console
1: Access Scopes
angular.element(targetNode).scope()
// ChildScope {$id: "005", this: ChildScope, $$listeners: Object, $$listenerCount: Object, $parent: Scope…}
angular.element(targetNode).isolateScope()
// Scope {$id: "009", $$childTail: ChildScope, $$childHead: ChildScope, $$prevSibling: ChildScope, $$nextSibling: Scope…}
2: Grab any Services
angular.element('html').injector().get('MyService')
// Object {undo: function, redo: function, _pushAction: function, newDocument: function, init: function…}
3: Access controller for directive
angular.element('my-pages').controller()
// Constructor {}
4: Chrome Console Features
angular.element($0).scope()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment