小编Mik*_*ke4的帖子

Angular 6:如何获取响应状态代码

如何获取服务代码?我尝试下面的代码,但它没有记录任何内容。

在 service.ts 文件中。

constructor(private http: HttpClient) { }

postForgotPass(email): Observable<Response> {

return this.http.post<Response>(envi.apiUrl +'/user/forgotpassword', {
  "email": email,
  "headers": headers,
  observe: 'response'

})
}
Run Code Online (Sandbox Code Playgroud)

在我的 component.ts 文件中

sendForgotPass() {
 return this.service.postForgotPass(this.emailFormControl.value)
    .subscribe(
      res => {
        console.log(res.status);
      })
    }
Run Code Online (Sandbox Code Playgroud)

angular angular-httpclient

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

angular-httpclient ×1