首页 > 解决方案 > 如何在 Router 和 NAvControl 中使用 ionic 4 中的前一个组件

问题描述

我使用以下代码使用了以前的 URL,(参考来自: https ://community.wia.io/d/22-access-the-previous-route-in-your-angular-5-app )

 this.router.events.subscribe((event) => {
      this.currentUrl = this.router.url;
                    if (event instanceof NavigationEnd) {
                         this.previousUrl = this.currentUrl;
                          this.currentUrl = event.url;
                    }
        });

但我想采用与 ionic 3(this.navController.getPrevious()) 类似的先前组件。我在 ionic 4 中找不到任何方法

我已经用谷歌搜索并搜索了角度帖子,但无法获得正确的结果。提前致谢。

标签: angular7ionic4

解决方案


推荐阅读