[英]How to make Https call in Angular2
Using Angular2 I have been making HTTP calls like this: 使用Angular2,我一直在像这样进行HTTP调用:
var headers = new Headers();
// headers.append('Content-Type', 'application/json');
headers.append('Content-Type', 'application/x-www-form-urlencoded');
this.http.post(
'http://192.168.1.100',
{headers: headers}
).map(
(res:Response)=>res.json())
.subscribe(
(response) => {
},
(err) => {
},
() => {
}
); //end of subscribe
I know need to make a call to Facebook's API which requires HTTPS, but I can't find in Angular2 docs anything about HTTPS calls. 我知道需要对需要HTTPS的Facebook API进行调用,但我在Angular2文档中找不到有关HTTPS调用的任何信息。 How do you make a HTTPS call in Angular2?
您如何在Angular2中进行HTTPS调用?
There is nothing else to do than specifying the https protocol in the URL you provide when using methods of the Http class: 使用Http类的方法时,除了在提供的URL中指定https协议外,没有其他事情要做:
this.http.post(
'https://some-address',
{headers: headers}
).map(...);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.