Angular 1.5.4 $http progress event

前端 未结 5 1657
滥情空心
滥情空心 2020-12-05 21:04

Now Angular 1.5.4 finally allows you to track progress event on $http provider but for some reason I keep getting the $rootScope as a response instead of an actual progress

5条回答
  •  失恋的感觉
    2020-12-05 21:14

    As seen in the docs here, the third parameter in a promise is a notify function.

    notify(value) - provides updates on the status of the promise's execution. This may be called multiple times before the promise is either resolved or rejected.

    It can be used like this:

    $http(requestData)
        .then(
            function success() {
                console.log('success');
            },
            function error() {
                console.log('error');
            },
            function notify() {
                console.log('notified');
            }
        );
    

提交回复
热议问题