I am attempting to utilize custom services prior to the application's initialization.
var initInjector = angular.injector(['ng', 'myModule']);
var myCustomService = initInjector.get('myCustomService');
var $http = initInjector.get('$http');
var $q = initInjector.get('$q');
Within myCustomService, I have the following code:
angular.module('myModule').service('myCustomService',myCustomService);
function myCustomService($location, $q){
// some logic
}
The error message I encountered is :
Uncaught Error: [$injector:unpr] Unknown provider: $rootElementProvider <- $rootElement <- $location <- myCustomService <- $location
It appears that the dependencies referenced in myCustomService are not being loaded properly.
Is there a more efficient way to organize the pre-bootstrap code and logic?