在ionic2中刷新页面 [英] Refresh a page in ionic2

查看:87
本文介绍了在ionic2中刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试过了:

有没有办法刷新一个页面, pre> window.location.reload();

  location.reload(); 

但它会重建应用程序..有没有办法只刷新那个页面(特定的屏幕)。

还试过:

 < ion-input * ngIf = no_internet === 1(click)=refresh($ event)>< / ion-input> 

在TypeScript中:

 刷新(刷新){
console.log('开始异步操作',刷新);
$ b $ setTimeout(()=> {
console.log('Async operation has ended');
refresher.complete();
},2000) ;


解决方案

试试这段代码:

  this.navCtrl.setRoot(this.navCtrl.getActive()。component); 


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 code :

this.navCtrl.setRoot(this.navCtrl.getActive().component);

这篇关于在ionic2中刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆