簡體   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