0

I have this function in app.js which connects to an api using promises. The app that is selected to be opened depends on the user ID.

me.boot = function () {
me.getUserID().then(me.openAppFunction);
};

Also, I have this function in my Home.js controller

getObjectsFromApp();

This function needs to be executed after the application is loaded in the other file, but I have no idea how to do this. This app.js file is not a service or a factory, it is just a file that is called when the application loads all the scripts with require.js. The only thing this file does is select which app to open in the api, so that is why it is only called once.

1 Answers1

0

An Event is probably what you are looking for...

You should stay in the angular environment, so, you should use $rootScope.$broadcast and $rootScope.$on and they can be used everywhere in your application because $rootScope is singletone.

this Why do we use $rootScope.$broadcast in AngularJS? could help you.

Community
  • 1
  • 1
Hitmands
  • 13,491
  • 4
  • 34
  • 69