使用HttpHeaders的Angular 5 JSONP请求

时间:2018-01-30 10:47:40

标签: angular jsonp

我尝试使用一些HTTP标头参数执行JSONP请求。使用 http.get 很简单:

let header = new HttpHeaders();
header.append(<header_param_name>, <header_param_value>);

this.http.get(<my_url>, { headers: header})

但是当我尝试用 jsonp ...

做同样的事情时
this.http.jsonp(<my_url>, <callback_param>)

&#34;选项&#34;参数??? O_o 如何在JSONP请求中的请求标头中发送参数?

感谢您的回复

1 个答案:

答案 0 :(得分:0)

official documentation 表示

  

必须安装合适的拦截器(例如通过HttpClientJsonpModule)。如果没有达到此类拦截器,那么配置的后端可能会拒绝JSONP请求。