How can you call Observable function to download data from server every 10 seconds?
My App service
getDevices (): Observable<Device[]> {
return this.http.get(this.deviceUrl)
.map(this.extractData)
.catch(this.handleError);
}
My AppComponent
ngOnInit():void {
this.getData();
this.getLastDeviceInterior();
this.getOutDevice();
this.getSetings();
}
getData()
{
this.dataService.getDevices().subscribe( devices => this.devices = devices,
error => this.errorMessage = <any>error);
}