Didn't get latest api data when refresh or open the Application

Hi,

I created ionic 2 (angular2 ) application, working fine every thing and installed apk in my mobile, After install open the app, its get the data from API and display the data in page1, After API updated (some changes like add extra data), Now i opened app didn’t get latest data , always show old data only, ionic refresh also there but no use, change another page and click page1 , but no luck. How to handle this scenario.

I uninstalled app and install now getting latest data, only install and unstall get latest api data, refresh and open page not getting latest data from API.

Can you please suggest me how to handle this scenario.
Code for refresh

doRefresh(refresher) {
console.log(‘Begin async operation’, refresher);
debugger;
this.createLoader();
this.errorMessage=null;
this._productService.getProducts().subscribe(data=>{this.products=<IProduct[]>>[];this.products=data;this.loading.dismiss();},

                                                  error=>{this.errorMessage=<any>error;});
setTimeout(() => {
 console.log('Async operation has ended');
  refresher.complete();
}, 2000);

}

// Page load code

getAllData():void{
debugger;
this.errorMessage=null;
this.loading.present();
this._productService.getProducts().subscribe(data=>{this.products=data;this.loading.dismiss();},
error=>{this.errorMessage=error;this.loading.dismiss();});
// this._productService.getProduct(1885).subscribe(data=>{this.products=data;console.log(“hi–>”+this.product)},
// error=>this.errorMessage=error);
}

//html code

prod.posttitle

{{prod.posttitle}}

Thanks,
Hemanth.

The issue is probably within the getProducts() method. I bet there is a conditional that says it there is data, don’t retrigger the API call and return the old data