I am trying to use custom services before the application bootstrap.
var initInjector = angular.injector(['ng', 'myModule']);
var myCustomService = initInjector.get('myCustomService');
var $http = initInjector.get('$http');
var $q = initInjector.get('$q');
And then in the myCustomService I got:
angular.module('myModule').service('myCustomService',myCustomService);
function myCustomService($location, $q){
// some logic
}
The error I got is :
Uncaught Error: [$injector:unpr] Unknown provider: $rootElementProvider <- $rootElement <- $location <- myCustomService <- $location
It seems that the dependencies used in myCustomService cannot be loaded..
There is a way to organise better the pre bootstrap code and logic?