被ionic4的路由跳转折磨了很久,试过很多土办法,总是不能完美的解决。
后来在博客内看到有朋友提供了一个解决方案,但是发现ios的右滑返回会报错
示例
ionViewWillEnter() {
const activateComponent = this.tabs.outlet.component;
if (activateComponent instanceof HomePage) {
// 调用页面方法
activateComponent.getSlides();
}
}
右滑返回会出现:
ERROR Error: Outlet is not activated
被折磨许久后想到了个投机的方法,方案如下:
在app.module.ts提供Events
示例
@NgModule({
imports: [],
declarations: [AppComponent],
providers