【问题标题】:Complex object sent to web api angular 4复杂对象发送到 web api angular 4
【发布时间】:2017-11-13 23:28:09
【问题描述】:

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

【问题讨论】:

  • 请将代码和消息发布为文本而不是屏幕截图。 How to Ask

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


【解决方案1】:

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

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

【讨论】:

  • 是的,就是这样。非常感谢。猜猜这是一个菜鸟问题:)
  • 有时第三只眼睛会有所帮助:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-22
  • 1970-01-01
  • 1970-01-01
  • 2016-03-01
  • 2020-03-15
  • 1970-01-01
相关资源
最近更新 更多