I'm trying to create a service in angular and within it, to get a service using angular's $injector.get(...)
.
(I know I can inject it, but I want to create it manually).
For some reason, I'm getting this error:
Uncaught Error: [$injector:unpr] Unknown provider:
$rootElementProvider <- $rootElement <- $location <- $urlRouter <- $state <- $location
(function () {
var $injector = angular.injector(["myApp"]);//Here is where I get the error
var myService= $injector.get("myService");
var pseudoService = function(){
var service = myService;
return{
service:service
}
}
app.factory("pseudoService", pseudoService);
}(angular));
Here is a plunker I made. I hope it demonstrates the issue precisely.