Created
May 18, 2016 10:21
-
-
Save simon04/f0d7f0aece43855498b57194457a5c28 to your computer and use it in GitHub Desktop.
Delay Angular $http requests for testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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