In my Ionic 2 project I am downloading data from server every 1 minute in a provider class, and whenever the new data comes I need to refresh a chart in my page class, how can I use observables to achieve that? This is how the code looks like in simplified version:
let startTime = new Date(Math.ceil(new Date().getTime() / 60000) * 60000);
this.Source = Rx.Observable.timer(startTime, 60000).timeInterval().pluck('interval');
this.Subscription = this.Source
.subscribe(data => {
this.http.post(this.ConnectionString)
.map(res => res.json())
.subscribe(data => {
//code
});
});