I decided to try to solve this with promise:
$rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams){
if ($rootScope.myObj) {
eventLogic();
} else {
getMyObj.init().then(function(res){
eventLogic();
});
}
function eventLogic() {
...
}
}
This solution completely solves my problem. It expects creation $rootScope.myObjand starts this service only once.
source
share