Is there a way to refresh only a page i.e. only one screen in ionic2.
I tried :
window.location.reload();
and
location.reload();
but it rebuilds the app .. is there a way to refresh only that page (particular screen).
Also tried:
<ion-input *ngIf="no_internet === 1" (click)="refresh($event)"></ion-input>
in TypeScript:
refresh(refresher) {
console.log('Begin async operation', refresher);
setTimeout(() => {
console.log('Async operation has ended');
refresher.complete();
}, 2000);
}
Try this, just pop one page and then push that page again.
Hope this will help.
I would do that : (based on @Ahmad Aghazadeh answer)
=> Push this page once more (loading it again)
=> Remove the page we were on (using index)
Example of using ion-refresher in an async function in ionic 3:
in your .html file:
and in your .ts file:
If you are willing to follow a common convention, I have found a very easy way to reload the current view (including all of its parameters). I tested this using Ionic3, but it should still apply in Ionic 2
Move all of your initialization code for every page into
ionViewDidLoad()
, which is run ONCE on the first time the view is loadedFrom anywhere else in the app, you can reload the current view with this code
Html:
TypeScript :
source : Ionic doc
Try this code :