angular-requirejs-seed icon indicating copy to clipboard operation
angular-requirejs-seed copied to clipboard

Application Loader

Open ghost opened this issue 9 years ago • 3 comments
trafficstars

I've build my app using your angular-requrejs-seed, now i need add loader because my app takes time to load first time is there any suggestion to add loader while requirejs loading all required files for app ?

ghost avatar Mar 09 '16 11:03 ghost

Traditional approach would be to add a new css class to <body> (or a div container if you have one). Then that class would be removed once js, in this case angular, has loaded. You could then use that class to display a css spinner, here are some examples of single-element css spinners:

http://projects.lukehaas.me/css-loaders/

Hope this helps

tnajdek avatar Mar 09 '16 12:03 tnajdek

Yeah i know that @tnajdek but problem is i cannot find angular.bootstrap(document, ['unation']); after event or onComplete event in the app.

ghost avatar Mar 09 '16 13:03 ghost

You don't need that, you can just use ngCss, use a dedicated directive or put the logic in your index controller.

Try something like this

<div class="loading" ng-class="{'loaded': true}"></div>

then in css .loading for spinner .loading.loaded remove spinner.

tnajdek avatar Mar 09 '16 13:03 tnajdek