如何使用 Ionic3 从另一个 class 重新加载页面

How to reload a Page from another class with Ionic3

我有 2 个文件夹。 /HomePage/SettingsPage.

/HomePage 包含:

/SettingsPage 包含:

我想从 settings.ts

"clean"/重新加载我的 HompePage (home.html)

我reload/refresh我的settings.html用这个:

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

你可以使用 Events

import { Events } from 'ionic-angular';

// SettingsPage (publish an event when you need to reload the HomePage)
constructor(public events: Events) {}

shouldReload() {
  events.publish('shouldReloadData');
}


// HomePage (listen for the event to reload the page)
constructor(public events: Events) {
  events.subscribe('shouldReloadData', () => {
    // Reload the page here
  });
}