Last Updated: February 25, 2016
·
9.283K
· gesellix

Initialization of an AngularJS Application with Asynchronous Data

Implementing bigger AngularJS applications often require you to perform backend requests before users can interact with them. There are several solutions and ideas possible, like using $route to switch from a "loading" view to an "initialized" view or by using promises. You can find several hints on the AngularJS forum by searching for initialization.

My team had similar issues with backend calls and too many $watch triggers being fired before our controllers or services had been initialized, so we implemented a promised based initialization service. The initialization service allows loose coupled configuration and is able to call services in a specified order.

You can find more details about the implementation at our blog including links to an online demo comparing a standard implementation and an example using the init service.

We would be glad to get feedback, so please leave a comment at our blog or at the AngularJS froum post.

Thanks!