Possible to use a custom Angular service before bootstrap? Possible to use a custom Angular service before bootstrap? angularjs angularjs

Possible to use a custom Angular service before bootstrap?


If it is OK to have a different instance of the service than the one that will be used by the app itself, you can achieve what you want like this:

angular.injector(['ng', 'yourApp']).get('SomeService').doStuff();

See, also, this short demo.
As you can see the service is re-instantiated (so counter starts from 0) for use within the Angular app.