getExample(): Observable<any> {
console.log('getExample');
return Observable
.timer(0, 5000)
.flatMap(() => this.httpClient.get('https://jsonplaceholder.typicode.com/posts'))
.map((r) => {
return r;
});
}
import { Observable, timer } from 'rxjs';
import { flatMap } from 'rxjs/operators';
getExample(): Observable<any> {
console.log('getExample');
return timer(0, 5000).pipe(
flatMap(() => this.httpClient.get('https://jsonplaceholder.typicode.com/posts'))
)
}