Angular $ http.post给出错误:参数无效。在IE 8中

时间:2022-02-10 13:39:17

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

应用程序在Chrome,Safari,Firefox等中运行良好。但在IE中,以下代码会出错:

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

The error:

Error: Invalid argument.

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

在$ rootScope之后发生。$ digest();在angular.js中的$ apply函数中

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

任何可以帮助调试这个神秘的Microsoft Internet Explorer™错误消息的想法?

1 个解决方案

#1


9  

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

所以...我发现添加引号让IE很开心。

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

这适用于Firefox,Chrome,Safari等:

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

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

但在IE(8)中失败了。但是,这适用于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.

如果这是由于角度或尝试调用的java后端方法,则无法澄清。

#1


9  

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

所以...我发现添加引号让IE很开心。

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

这适用于Firefox,Chrome,Safari等:

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

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

但在IE(8)中失败了。但是,这适用于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.

如果这是由于角度或尝试调用的java后端方法,则无法澄清。