在ionic2中刷新页面

Nar*_*yas 13 html javascript refresher ionic2 angular

有没有办法只刷新一个页面,即ionic2中只有一个屏幕.

我试过了 :

window.location.reload();
Run Code Online (Sandbox Code Playgroud)

location.reload();
Run Code Online (Sandbox Code Playgroud)

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

还尝试过:

<ion-input *ngIf="no_internet === 1" (click)="refresh($event)"></ion-input>
Run Code Online (Sandbox Code Playgroud)

在TypeScript中:

refresh(refresher) {
    console.log('Begin async operation', refresher);

    setTimeout(() => {
        console.log('Async operation has ended');
        refresher.complete();
    }, 2000);
}
Run Code Online (Sandbox Code Playgroud)

Ahm*_*deh 19

试试这段代码:

this.navCtrl.setRoot(this.navCtrl.getActive().component);
Run Code Online (Sandbox Code Playgroud)

  • 它删除所有以前的导航. (4认同)
  • 这不是解决方案,正如@Yawar所说,你删除了所有以前的导航, (4认同)