小编Run*_*ali的帖子

在angular2中使用subscribe调用成功,错误回调?

给responsece.json()提供的功能不适用于我的情况

component.ts

 this.AuthService.loginAuth(this.data).subscribe(function(response) {
  console.log("Success Response" + response)
},
  function(error) {
  console.log("Error happened" + error)
},
  function() {
  console.log("the subscription is completed")
});
Run Code Online (Sandbox Code Playgroud)

AuthService.ts

     loginAuth(data): Observable<any> {
  return this.request('POST', 'http://192.168.2.122/bapi/public/api/auth/login', data,{ headers:this. headers })
      .map(response => response)
      //...errors if any
      .catch(this.handleError);
  }
Run Code Online (Sandbox Code Playgroud)

给[object,objet]如果我把地图功能服务像.map(response => response.json())给出错误就像responce.json()不是函数

请帮我

angular2-template angular2-services angular

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