I have an angular application which is based around a core service.
To ease debugging, I'd rather not have to remember the following invocation (from how to debug angular services in browser):
tasks = angular.element(document.body).injector().get('tasks');
So my first thought was to stick this statement in a script tag in my index.html, but if I do that, it fails with
Uncaught TypeError: Cannot read property 'get' of undefined
I was looking for the equivalent of jQuery's document ready, but it seems that's not the Angular way. The Angular way seemed to be a construct like this (from https://plus.google.com/+MicahGodbolt/posts/CiKyN2YUafM):
angular.module('mushin', []).run(function() {
window.tasks = angular.element(document.body).injector().get('tasks');
})
This however gives me the same error.
What's the proper way to get an angular service into a javascript variable for debugging in the console?