Closed mkunysz closed 8 years ago
The answer is in the angularjs documentation:
angular.module('myModule', []).
config(function(injectables) { // provider-injector
// This is an example of config block.
// You can have as many of these as you want.
// You can only inject Providers (not instances)
// into config blocks.
}).
run(function(injectables) { // instance-injector
// This is an example of a run block.
// You can have as many of these as you want.
// You can only inject instances (not Providers)
// into run blocks
});
Or you can do something like this https://github.com/sahat/satellizer/issues/658, although I don't necessarily recommend it, because those Satellizer factories were never meant to be used directly like that. If Angular 1.x had a concept of private services and factories, I'd make them private, but unfortunately that's not the case, you can easily import any Satellizer service if you know its name.
As for why can you configure Satellizer only during the config
phase - that was simply my decision during the initial development in 2014. It's what a lot of AngularJS libraries do, so I followed in their footsteps. It was not until a few months ago when someone posted they want to change Satellizer configuration outside the config
phase, e.g. controller, or run
phase in this case.
@sahat thank you for this satisfying answer!
I also found this general solution which is quite hacky: http://stackoverflow.com/a/21536845/1632314
Great :+1: . I am going to close this issue if that answers your question.
Is there a possibility to set up satellizers configuration (client ids, redirect urls etc) in angular run phase ?