Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular $http.post gives Error: Invalid argument. in IE 8

App works fine in Chrome, Safari, Firefox etc. But in IE the following code gives an error:

$http.post('/myurl', 55)
  .success(...)
  .error(...)

The error:

Error: Invalid argument.

Happens after $rootScope.$digest(); in the $apply function in angular.js

Any ideas that could help debugging this mysterious Microsoft Internet Explorer™ error message?

like image 280
Cotten Avatar asked Jan 07 '14 10:01

Cotten


1 Answers

so... I turns out adding quotes makes IE happy.

This works in Firefox, Chrome, Safari, etc. :

$http.post('/myurl', myNumberVariable)

But fails in IE (8). However, this works in IE 8:

$http.post('/myurl', myNumberVariable.toString())

Didn't get clarification if this was due to angular or the java backend method that was tried to call.

like image 177
Cotten Avatar answered Oct 18 '22 13:10

Cotten