Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

a simple library for making Angular $http requests cancellable

License

NotificationsYou must be signed in to change notification settings

EPICmynamesBG/angular-http-cancellable

Repository files navigation

A simple libary for making Angular $http requests cancellable

Note: This library only applies for Angular v1. Testing only done on angular > 1.6.0.

Recent Updates

  • Removed Angular $q service to reduce potential conflicts with other libs/use cases

Setup - Install via npm

npm install --save angular-http-cancellable

Link to the file in the node_modules folder.node_modules/angular-http-cancellable/dist/angular-http-cancellable.min.js

Usage

Import the module into your angular application

varmyApp=angular.module('myApp',['http.cancellable']);

Import and use$httpCancellable just like you would use$http.

myApp.factory('SomeFactory',function($httpCancellable){varfactory={};factory.someRequest=function(){varrequest=$httpCancellable({method:'GET',url:'http://example.org/hello'}).then(function(response){//handleResponse}).catch(function(error){//Cancel will trigger error here//Handle error}).finally(function(){//do something else});if(requestTakesTooLong()){request.cancel();}returnrequest;};returnfactory;});

Testing

Testing made using karma + mocha + chai. To test, just runnpm test.** Will probably need to compile the dist file first by usinggulp **

Contributing

Contributions and feedback accepted! For most cases, please submit an issue to the project with the correct tag (ie. feature request, bug).

Development

To contribute to developing, please fork the repository and submit a pull request :)

License

MIT (see full in LICENSE file)

About

a simple library for making Angular $http requests cancellable

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp