Skip to content

Instantly share code, notes, and snippets.

@simon04
Created May 18, 2016 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simon04/f0d7f0aece43855498b57194457a5c28 to your computer and use it in GitHub Desktop.
Save simon04/f0d7f0aece43855498b57194457a5c28 to your computer and use it in GitHub Desktop.
Delay Angular $http requests for testing
angular.module('app').config(function($httpProvider) {
$httpProvider.interceptors.push(delayHttp);
function delayHttp($timeout) {
return {
response: function(response) {
return $timeout(angular.identity, Math.random() * 1000, true, response);
}
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment