Angular JS: is returning null in Internet Explorer

I'm making an ajax call from Angular JS:

var response = $
    '/services/login/?_nochache='+new Date().getTime(),      

I'm adding the _nocache setting, thinking that maybe some cache or something like that.

I'm also converting the object credentials into string thinking that Internet Explorer could not recognise the object.

I'm really lost here, In chrome the call works perfectly, in IE 10, the response of the service is null.

What can be causing this?


The service is returning 401, which is ok, since the user is wrong, but the response should be (as is in other browsers), the error string saying the user is wrong, in this case is null.

I'm using the promise like this:

promise.then(onLoginOk, onLoginError);

function onLoginError(response) {

The console returns

  "data": null,
  "status": -1,
  "config": {
    "method": "POST",
    "transformRequest": [
    "transformResponse": [
    "url": "",
    "data": {
      "username": "[email protected]",
      "password": "password"
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json;charset=utf-8"
  "statusText": ""


Here is the Response body I get in IE. enter image description here

These are the headers I get with the 401 which is correct, but the response body is wrong. enter image description here

This seems like same problem of mine.

In my case, my request function works well in every browser except MS Edge.

I tried to find solution or reason, and finally I got one.

Some answers suggested adding tags like

<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="Mon, 26 Jul 1997 05:00:00 GMT" />

or adding code into config like

$httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
// extra
$httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
$httpProvider.defaults.headers.get['Pragma'] = 'no-cache';

but these couldn't solve my problem.

Finally I saw one answer said this may occurred by a kind of policy handling caches in Edge.

This can occur when I use local server to send requests or get responses.

And it will gonna disappear when test on other server not on local.

I hope your problem is same as mine.

This is kind of stretch, please don't go nuts if I am wrong here. Don't have the rep points to comment.

Have you looked into this article? Error 401 and 403 only in Internet Explorer (not in Chrome, Firefox, ..) - IIS configuration?