繁体   English   中英

如何在Angular2中进行Https调用

[英]How to make Https call in Angular2

使用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

我知道需要对需要HTTPS的Facebook API进行调用,但我在Angular2文档中找不到有关HTTPS调用的任何信息。 您如何在Angular2中进行HTTPS调用?

使用Http类的方法时,除了在提供的URL中指定https协议外,没有其他事情要做:

this.http.post(
    'https://some-address',
    {headers: headers}
).map(...);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM