Ionic 5 angular 后退导航

Ionic 5 angular back navigation

我在 Ionic 5 中有一个使用 Angular 的应用程序,我需要在其中以编程方式从当前页面导航到上一页。我尝试使用:

this._location.back();

它可以工作,但不会像使用 <ion-back-button> 导航时那样触发后退导航动画,它只是切换页面。所以问题是您如何以类似于 <ion-back-button> 的方式使用 Angular 在 Ionic 5 应用程序上以编程方式导航回?

constructor(private navController: NavController){}

 this.navController.back();

前面的回答是正确的。正如 Ionic 的开发者所说:

https://github.com/ionic-team/ionic-framework/issues/20448#issuecomment-586288155

仍然可以使用 NavController(与 angular 路由结合使用),将来不会弃用。缺少这方面的文档。