I am utilizing Angular 6 and attempting to retrieve JSON data from the server at a 5-second interval.
This is my service code:
getExample(): Observable<any> {
console.log('getExample');
return Observable
.timer(0, 5000)
.flatMap(() => this.httpClient.get('https://jsonplaceholder.typicode.com/posts'))
.map((r) => {
return r;
});
}
I would appreciate any assistance in fixing this code.
PS: A simpler service worked without any issues