urish / angular-spinner

Angular directive to show an animated spinner (using spin.js)
MIT License
693 stars 146 forks source link

start and stop spinner automatically when page is loading #88

Closed mohammad6006 closed 7 years ago

mohammad6006 commented 8 years ago

Is it possible to active spinner when page is loading and after loading finished , spinner change to stop without using start stop function for each action in controller?

ghost commented 7 years ago

Hi @mohammad6006 , Thanks for opening the issue

Which page loading you mean? $http resources loading or router loading?

For router loading (when navigating between views) you can use $routeStart/Sucess events depends on the route you're using (ng-router/ui-router) - And this difference of routers give the responsibility on the developer to extend this

For $http request, trust me you don't want to link them (or most of them) with this, because good systems do a background job (in case you link this into $httpInterceptors you'll have so many flushing spinners for every background request!)

Feel free to reopen the issue if I misunderstood