Initialise AngularJS application with server data

Posted by itungnt on Thursday, September 1, 2016

Sometime you need to init the data from server before you want the app to be loaded, if you use ng-app the Angular application always load before you can make ajax call to retrieve data.

The solution for that is to remove the ng-app and bootstrap the Angular JS application programmatically after we got the data from server.

But you need to handle the case the API or server is down and the data is never returned then the app will not be bootstrapped.


comments powered by Disqus