I am using $http to post data to server.
There are two OPTIONS requestMethod calls before making a POST request.
However, the POST request is not made sometimes.
As I am updating html on return of this call, the page hangs.
$http({
url: scope.Settings.url,
method: "POST",
data:data,
withCredentials: true
}).then(function (data, status, headers, config) {
setBusyState(false);
scope.rModel = scope.search;
scope.Results = data.data;
}, function (data, status, headers, config) {
scope.Results = [];
setBusyState(false);
});
EDIT: This does not happen always. Only a few times.
This appears to happen only in Chrome, whereas it is fine in IE
app.config(['$httpProvider', function ($httpProvider) { $httpProvider.interceptors.push('requestInterceptor'); $httpProvider.defaults.cache = false; if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; } ]);