为什么AngularJS 2 HTTP Post只接受字符串数据?

时间:2016-05-27 06:05:08

标签: javascript angularjs angular http-post

我想知道为什么在AngularJS 2(2.0.0-beta.13)中,HTTP Post方法只接受字符串数据作为主体,而不是像AngularJS 1中的情况那样接受JavaScript对象。

AngularJS-1:

$http.post(someUrl,someObject)

AngularJS-2:

http.post(someUrl, JSON.stringify(someObject))

由于

1 个答案:

答案 0 :(得分:4)

因为尚未实施对其他类型的支持https://github.com/angular/http/issues/75