Skip to content

Instantly share code, notes, and snippets.

@adnan-i
adnan-i / angular-timeout.html
Last active March 16, 2017 11:55 — forked from orjan/angular-timeout.html
Workaround for $httpProvider.defaults As discussed here http://stackoverflow.com/a/15020611/1095616, it is not possible to set default timeout in $httpProvider. This gist offers a workaround.
<!doctype html>
<html ng-app="myApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
</head>
<body>
<div ng-controller="TodoCtrl">
<button ng-click="beQuickOrBeDead()">Fetch with 100ms timeout</button>
<button ng-click="neverEndingStory()">Fetch with default timeout</button>