pbojinov
3/2/2015 - 7:37 PM

Debugging AngularJS Apps from the Console - http://ionicframework.com/blog/angularjs-console/

Debugging AngularJS Apps from the Console - http://ionicframework.com/blog/angularjs-console/

// 1. Access Scopes
angular.element(targetNode).scope()
// -> ChildScope {$id: "005", this: ChildScope, $$listeners: Object, $$listenerCount: Object, $parent: Scope…}
// isolated scopsa
angular.element(targetNode).isolateScope()
// -> Scope {$id: "009", $$childTail: ChildScope, $$childHead: ChildScope, $$prevSibling: ChildScope, $$nextSibling: Scope…}

// 3. Grab any Services
angular.element(document.querySelector('html')).injector().get('MyService')
// -> Object {undo: function, redo: function, _pushAction: function, newDocument: function, init: function…}
// Or slightly more generic
angular.element(document.querySelector('.ng-scope')).injector().get('MyService')

// 4. Access controller for directive
angular.element('my-pages').controller()
// -> Constructor {}