Great response! I think that your answer is the best. El martes, 31 de julio de 2012 18:41:52 UTC-3, Ruaidhrí Devery escribió: > > Hi, > > I've come across something like this before. I wanted to preload images > before my app template got displayed and also show a preloader while this > was happening. What I did was split my app home screen up into the > following pages: > > index.html -> root page with an ng-include tag > preload.html -> page showing loader > main.html -> main application template > > I have an 'AppDisplayCtrl' applied to the ng-include tag, this manages the > value of the 'src' attribute. That ng-include @src is set to 'preload.html' > while preloading is happening, once it is complete that value is switched > to 'main.html' and the main application template is loaded and compiled, > triggering the rest of your controllers. Chances are most of your services > wont even be instantiated until after your main application template is > compiled so you can be sure anything you preload will be available right > away. > > In my app I used a comment directive to handle the preloading, it > broadcast an event from the rootScope which is what triggers the > AppDisplayCtrl to switch from 'preload.html to 'main.html'. > > You can see a working example of that preload directive here: > http://jsfiddle.net/rur_d/qU3Zs/1/ > > rur > > > > > On Tuesday, 31 July 2012 10:20:44 UTC-7, Alan Smithee wrote: >> >> Hopefully I'm missing something obvious. My application uses a config >> file (json) with all sorts of read-only information. I want to load this >> file once at application start via some sort of http get and have it >> available to any services, etc that need it. My problem is that I need to >> pause application loading until the data is ready. >> >> I keep running into timing problems where the data isn't available before >> its requested, or other dependents are being accessed before they have been >> created by a success callback. Pausing execution seems preferable to >> chaining a bunch of callbacks. I've looked at things like $provide.constant >> and module.run, but haven't gotten anything that works right. >> >> Thanks for your suggestions. >> >
-- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
