Every 10 seconds, I make a call to a RESTful service through an Angular service called "myservice" and a function called "foo."
ngOnInit ()
{
interval (10000).pipe (startWith (0), mergeMap (obs =>
this.myservice.foo ())).subscribe (resp =>
{
this.data = resp;
},
error =>
{
console.log ("error");
}
);
}
The current setup works fine when the connection to the REST service is active. However, when the REST service is down, the interval stops as well.
How can I modify the code to keep the interval running, even when the REST service is unavailable?