Last Updated: February 25, 2016
·
2.401K
· 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.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside