Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS: How to load json feed before app load?

Tags:

json

angularjs

I'm just learning angularJS (using angular-seed) and I need to load my site config from a JSON feed before the rest of the site loads.

Unfortunately, using $http or $resource doesn't return the feed in time for the rest of the app to load.

What is the correct way to force the app to load this data before the rest of the app?

like image 373
Bunkered Avatar asked Nov 09 '12 12:11

Bunkered


1 Answers

You have to use the Controller.resolve method. Check out Misko's (one of the core Angular developer) answer https://stackoverflow.com/a/11972028/726711

like image 150
Max Avatar answered Sep 22 '22 14:09

Max