Open bfredo123 opened 7 years ago
We may be able to solve that by wrapping the initial sl:login
broadcast in a setTimeout
function.
Thanks for your answer! Isn't there a risk that depending on the system, and other tasks running, the timeout elapses before the config finishes?
This is something we would need to test, but Angular's $timeout
should make sure everything else is bootstrapped before it is run.
I am trying to catch the 'sl:login' event broadcasted by the superlogin $get method (the one fired right after _session = JSON.parse(...) ).
I would like to call $rootScope.$on in order to listen to this event from within my own service. But since this service is dependent from superlogin, its provider will be called necessarily after the superlogin one, so I believe there is no way to catch the 'sl:login' event. Am I right?
The way I worked this around is to call superlogin.authenticate() from my service factory, and everything is working fine: this way I can get the credentials stored from a previous application usage, if any.
But then, maybe the mentioned $broadcast call is of no use for no-one (I am not an Angular factory/provider exper, so I may be wrong). Hope this helps anyway.