How to avoid back button generated by [navPush] (处理生成的后退按钮)

How to avoid back button generated by [navPush] (Handling generated back Button)

我有一个主页,这是我的第一个屏幕。

在我导航到某些页面后单击按钮我需要返回主页而不需要返回按钮

导航我用[navPush]='pageName';

navPush 自动生成后退按钮。但是我回去的时候不需要后退按钮。

我试过 navPop 它工作正常,但问题是它只能进入下一页。

例子

if i have 10 pages from 10th page i have to come to 1st page using ionic navPop i am not able to achieve this .

When i tried with navPush i am able to get back but i am not able to avoid the back button in homepage.

问题:

Is there anything else i am missing how to avoid the back button generated using navPush or navPop

On clicking a button I need to get back to the home page without back button

请看看这个working plunker

  1. 您可以这样使用 setRoot() method

    this.navCtrl.setRoot(HomePage);
    
  2. 如果您确实需要使用push方法而不是setRoot,您也可以尝试使用ViewController中的showBackButton() method

    showBackButton(Set): Set if the back button for the current view is visible or not. Be sure to call this after ionViewWillEnter to make sure the DOM has been rendered.