簡體   English   中英

通過觀察在 angular 中獲得完整響應:'response' with other settings

[英]Get full response in angular with observe: 'response' with other settings

有用

return this.http.post(url, data, {observe: 'response'})

但由於某種原因它沒有

let options = {
  headers: new HttpHeaders().set('Content-Type', "application/json"),
  withCredentials: true,
  observe: 'response'
}
return this.http.post(url, data, options)

為什么以及如何在這種情況下使用 observe: 'response'?

你應該准確地說出什么不起作用。 我猜 typescript 編譯器在抱怨類型。

你可以這樣解決這個問題: return this.http.post(url, data, options as any)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM