Angular 2/4 - 管理没有返回值的响应?

时间:2017-06-26 10:12:29

标签: angular angular-http

请告诉我。

有些查询没有返回值,但有一个状态代码。我想根据此代码发出消息。该函数有效,但不会进入showNotification方法。

......

let params = new URLSearchParams();
      params.set('token', token);
      this.http.get(CaSettings.API_HOME_LOGOUT, new RequestOptions({params: params, headers: this.getHeaders()}))
.map(this.showNotification)
.subscribe();
}

......

  showNotification(res: Response) {
    if (res.status == 200) {
      this.notification.success("success", "success")
    }
  }

感谢。

0 个答案:

没有答案
相关问题