1.0.3 • Published 8 years ago

angular-http-attach-promise v1.0.3

Weekly downloads
15
License
none
Repository
github
Last release
8 years ago

angular-http-attach-promise

Build Status

npm install --save angular-http-attach-promise

Usage

Simply add it to your Http interceptors. A Promise will be will be attached at each request (if it doesn't specify the timeout field):

  /* in your angular.config phase */
  ...
  $httpProvider.interceptors.push('HttpAttachPromiseInterceptor')
  ...

And in your application code add some service that handles pending requests, ideally with $http.pendingRequests:

function RequestHandler($http) {
  this.cancelPending = function(){
    angular.forEach($http.pendingRequests, function(request) {
      if (request.cancel && request.timeout) {
        request.cancel.resolve()
      }
    })
  }
}

UMD

This is an UMD package.

License

Do whatever you please with this.

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago