Skip to content

Instantly share code, notes, and snippets.

@selfish
Last active April 30, 2016 23:27
Show Gist options
  • Select an option

  • Save selfish/9e55ad3832e2067056d8 to your computer and use it in GitHub Desktop.

Select an option

Save selfish/9e55ad3832e2067056d8 to your computer and use it in GitHub Desktop.
Angular Debugging via console; Import angular service / $rootScope to console.
// Use Angular service in console:
// clientDetails service (get method):
angular.element(document.body).injector().get('clientDetails').get();
// configAPI service (set method):
angular.element(document.body).injector().get('configAPI').set();
// Also works with var:
var configAPIService = angular.element(document.body).injector().get('configAPI');
configAPIService.set();
// View $rootScope in console:
var rootScope = angular.element('body').injector().get('$rootScope');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment