JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp">
<div ng-controller="TodoCtrl">
<p>{{isWorking}}</p>
<button ng-click="slow()">Get some...</button>
</div>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.config(['$httpProvider', function ($httpProvider) {
// $httpProvider.defaults.timeout = 300;
}]);
myApp.controller('TodoCtrl', function ($scope, $http) {
$scope.isWorking = "YES";
$scope.slow = function () {
console.log("trying to get some");
$http.jsonp("http://jsfiddle.net/echo/jsonp/?world=hello&delay=3&callback=JSON_CALLBACK", {
timeout: 100
}).success(function (data, status, header, config) {
$scope.isWorking = "Req ok";
console.log(data);
console.log("Timeout", config.timeout);
}).error(function () {
$scope.isWorking = "Req not ok";
});
};
});