复杂对象发送到web api angular 4

时间:2017-11-13 15:24:27

标签: angular http typescript asp.net-web-api request

我正在尝试使用新的HttpClient和HttpParams发出一个put请求,但似乎我无法正确发送更新的对象。我正在尝试将对象作为这样的参数:This is where i make my request这是我的类:myclass这些是请求标题enter image description here和params部分:enter image description here请求响应抛出空引用异常,因为它无法映射它们我猜?

1 个答案:

答案 0 :(得分:1)

HttpParams应为3rd argument。所以你应该这样调用put:

this.http.put(this.url, myComplexObject, this.options);