0

What is the best aproach to design a loading spinner component for a single page web application designed with Angular Js.The web page consists of multiple components and widgets which makes ajax requests? Do we have to take into account the registering and degistering of spinner?

  • Possible duplicate of [Angularjs loading screen on ajax request](http://stackoverflow.com/questions/17144180/angularjs-loading-screen-on-ajax-request) – wpercy Jan 26 '16 at 17:30

2 Answers2

0

I would use font awesome, a very popular library.

works like this ...

<i ng-if="loading" class="fa fa-the-icon-you-want fa-spin"/>

this will put a spinning icon on your screen.

in your controller ...

$scope.loading=true;

$http.get("/path").then(function(response) {
    $scope.loading=false;
}).catch(function(errorResponse) {
    $scope.loading=false;
});
danday74
  • 52,471
  • 49
  • 232
  • 283
0

I'm really think you don't need invent the wheel.

You can use angular directive that exist for free and customize them if u need.

for example:

angular-spinner github

Possible configuration options are described in the spin.js homepage

ofir fridman
  • 2,691
  • 2
  • 17
  • 27