Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 768 Bytes

README.md

File metadata and controls

26 lines (15 loc) · 768 Bytes

angular-http-throttler

AngularJS service for throttling $http requests

Requires AngularJS >= 1.1.5

Inspired by the angular-http-auth module @ https://github.com/witoldsz/angular-http-auth

Usage

Add the http-throttler module as a dependency to your application module:

var myAppModule = angular.module('MyApp', ['http-throttler'])

Add the httpThrottler service into the $httpProvider.interceptors array

myAppModule.config(['$httpProvider', function($httpProvider) {
  $httpProvider.interceptors.push('httpThrottler');
});

Modify the httpThrottler service code, setting the max # of requests.

if reqCount >= 10 // Change this to some # you're interested in

Both coffeescript and js files are included.