Ced Ced - 1 month ago 13x
TypeScript Question

Angular wait for promise in module.run

I'm working on an angular application and I'm using a service which should load some details from the server before the execution of the application is continued.

myService.loadSomething() //The application should pause until the execution of the Service
//is completed until this the browser shoudl stay in a "loading state"

Is sometehing like this even possible?


Get yourself familiar with $q and try to plan your application as it must not wait for anything to happen. Asynchronism is the key of every AngularJS app.

If you are using the router, get familiar with resolve, that may also help you "waiting" for data before a route/view will be shown.