In my Ionic 2 app I'm getting data from the SqlStorage and from a HTTP.get request. When I get the data from the HTTP request my page refreshes as expected using the new data, but when I get the data from the SqlStorage it doesn't refresh and the new data is only shown when I 'pull to refresh'.
PS: I'm using TypeScript.
This is the SqlStorage get:
oldFeeds() {
return new Promise((resolve, reject) => {
this.storage.get('feeds').then(data => {
resolve(JSON.parse(data));
});
});
}
And this is the HTTP get:
feeds() {
return new Promise((resolve, reject) => {
this.http.get('http://foo.bar').map(res => res.json()).subscribe(data => {
resolve(data);
},
e => reject(e));
});
}
These methods are inside a service and the calls to them are exactly the same:
this.feedsService.oldFeeds().then(data => {
this.feeds = data;
this.entries = this.feeds[this.activeIndex].entries;
});
this.feedsService.feeds().then(data => {
this.feeds = data;
this.entries = this.feeds[this.activeIndex].entries;
});
Any ideas on why this is happening and what could I do to solve it? Thanks!