1
$http({
  url: Config.ApiURL + "/site/go",
  method: "POST",
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  data: $.param(testimony)
}).progress(function (data, status, headers, config) { //Not sure about this line
  console.log('progressing');
}).success(function (data, status, headers, config) {
    console.log('success');
});

I want to display something before it successes or error, so im not sure about .progress part, i just inserted it there as an example and for you to imagine my problem.. is it possible? is there a built-in function for that?

BTW, im new to angular. TIA :)

Deblaton Jean-Philippe
  • 11,188
  • 3
  • 49
  • 66
  • You need a directive. There is already a post an SO: http://stackoverflow.com/questions/17144180/angularjs-loading-screen-on-ajax-request – devz Jun 26 '15 at 07:25

2 Answers2

0

According to some post I found on github (https://github.com/angular/angular.js/issues/1934 , see the post from 26th april 2014), you should be able to do it like that :

 $http({method: 'GET', url: '/someUrl',progress:trackProgress}).then(function(result){
       // handle result

});

Where tarckProgress would be a callback to call to handle the progress state.

Deblaton Jean-Philippe
  • 11,188
  • 3
  • 49
  • 66
  • I know that also the third parameter of the `then` function is the the notify callback. This can be hooked into the XHR progress update – Callum Linington Jun 26 '15 at 07:29
0

If you want to show the progress spinner / bar, and in addition to that if you want to show something else, you can use angular-loading-bar

ryanyuyu
  • 6,366
  • 10
  • 48
  • 53
John
  • 465
  • 2
  • 8