我尝试让我的 HTTP 客户端请求由变量控制。但我不确定如何设置过滤器。
任何帮助,将不胜感激。
go : boolean = true; // skip the request if false
ngOnInit ()
{
interval (10000).pipe (
startWith (0),
mergeMap (obs => this.myservice.request ().pipe (catchError (error =>
{
console.log ("error: " + error);
return empty ();
})))).subscribe (resp =>
{
console.log ("response: " + resp);
});
}