4

I've searched all over the web and can't seem to find anything that says, one way or the other, whether or not I can get the status of downloading data during an $http.get request. The application I'm writing regularly downloads a lot of data which can take up to 30 seconds. Rather than display an animated loading gif, I would like to display a progress bar which shows the status of how much of the data has downloaded. I am using Angular.js and this is what my get request looks like.

$http.get(<apiURL>).success(function(data,status,headers,config){
    $scope.data = data;
});

On the success of the request I populate my page with the data. Is there some way to, in the time it's fetching that data from the server, to constantly read the download status?

John Woodruff
  • 1,608
  • 16
  • 29

1 Answers1

0

I found a fantastic library to use in order to achieve what I wanted without having to change the back-end server code. It's a Github project called Angular Loading Bar. Simply bower or npm install and it automatically works on your http requests with Angular. Excellent library.

John Woodruff
  • 1,608
  • 16
  • 29
  • 1
    The [Angular Loading Bar](https://github.com/chieffancypants/angular-loading-bar) is only a loading bar, not a progress bar. It nicely simulates a progress but does not derive actual progress data from $http service but only nicely simulates it. Actually receiving a real progress from $http is not implemented yet (1.3.15) in angular. – Max Apr 01 '15 at 07:30
  • Exactly what I was saying. You can use it as is to simulate a progress bar. It isn't exactly what I was looking for, but for what I needed it's as close as I can get. – John Woodruff Apr 04 '15 at 17:49