首页 > 解决方案 > Angular 8 - 打印 http 响应正文

问题描述

我使用的是 Angular 7,我曾经通过以下方式获取响应的主体:

import { Http } from '@angular/http';

constructor(public http: Http...)

this.http.get(myURL).subscribe(
  (data) => {
    const myURL_body = data['_body'];
  })

现在......使用角度8:会怎么样?

import { HttpClient } from '@angular/common/http';

constructor(public httpClient: HttpClient...)

this.httpClient.get?

标签: angular

解决方案


this.httoClient.get(myURL).subscribe(
(data)=>{
const myURL_body = data['_body'];
}
)


推荐阅读