I am trying to define services dynamically in angularjs, as the docs say, $provide and $injector are services, so they should be entered in module.run . I need to make dynamic services available from the bootstrap of the application, so I'm trying to define them in module.run
angular.module('remote.interface',[]) .run(['$provide', '$injector', function(provide, injector){
but it ends up with an error: [$injector:unpr] Unknown provider: $provideProvider <- $provide and the same eror for $injector if I try to remove $ include injection.
Where is the mistake?
[EDIT]
after some research, I tried something like this:
var module = angular.module('remote.interface',[]) .run([function(){ var provide = module.provider(), injector = angular.injector(); provide.value('my.val',{i:'am a value'}); injector.get('my.val');
even if I delete the call to injector.get , if I try to enter my.val , for example, into the controller of another module, angular throws the same error.
angularjs
aleclofabbro Jul 12 '14 at 12:17 2014-07-12 12:17
source share