小编a45*_*45b的帖子

我可以更改 Rxjs Retry 上的查询参数值吗?

我有这个服务,最初返回 null (初始化后台作业)[ this.q = true]。但稍后如果我将其更改为,[ this.q = false]并且如果工作成功,它将返回值。

所以,首先我需要打电话[ this.q = true]并重试[ this.q = false]。但下面的代码不起作用。它总是使https://api.example.com?q=true

return this.http.get('https://api.example.com?q=' + this.q)
  .map((res: any) => {    
    if (res === null) {          
      throw new Error("not enough tiles !");
    }                
    return res;
  }).catch((e) => {    
    this.q = false;
    return error;
  })
  .retryWhen(e => e.delay(2000))
  .retry(3);
Run Code Online (Sandbox Code Playgroud)

rxjs rxjs5 angular

6
推荐指数
1
解决办法
2326
查看次数

标签 统计

angular ×1

rxjs ×1

rxjs5 ×1