美文网首页
angular新设置网络请求超时时间

angular新设置网络请求超时时间

作者: Bager | 来源:发表于2020-06-30 06:59 被阅读0次
this.http.get('https://httpstat.us/200?sleep=5000')
  .pipe(timeout(1000))
  .subscribe(response => {
    console.log('forceTimeout', response);
  }, (error) => {
    console.log('Error', error);
    this.error = error.constructor.name;
  })

相关文章

网友评论

      本文标题:angular新设置网络请求超时时间

      本文链接:https://www.haomeiwen.com/subject/rphtqktx.html