Angular 2: How to access an HTTP response body?

后端 未结 10 2023
南方客
南方客 2020-12-13 12:25

I wrote the following code in Angular 2:

this.http.request(\'http://thecatapi.com/api/images/get?format=html&results_per_page=10\').
      subscribe((re         


        
10条回答
  •  天涯浪人
    2020-12-13 13:13

    This is work for me 100% :

    let data:Observable = this.http.post(url, postData);
      data.subscribe((data) => {
    
      let d = data.json();
      console.log(d);
      console.log("result = " + d.result);
      console.log("url = " + d.image_url);      
      loader.dismiss();
    });
    

提交回复
热议问题