Last Updated: February 25, 2016
·
2.157K
· jgrund

AngularJS: Accessing provider instances via the console

Ever want to get an instance of a service for debugging purposes in the console?

To do so you can access the injector that is available on a jQuery wrapped element and then get an instance of the service you want to look at.

For example to get an instance of the $q service you can do:

q = $('body').injector().get('$q);

You can than access any of the methods available on the $q service.