NavController doesn't work in Ionic 4

#1

I’m injecting NavController in my constructor as I want to push a page. But, below code doesn’t work in Ionic 4. It was totally okay in Ionic 3.

constructor(public menuCtrl: MenuController, public navCtrl: NavController) {
this.menuCtrl.enable(true);
}

ngOnInit() {
}

goToSecondPage()
{
this.navCtrl.push(list);
}
}

#2
1 Like
#3

Yes, it works. But, there is no back button in the navigation bar. Is there any way to create backButton in Navbar.

goToSecondPage()
  {
    this.navCtrl.goForward('/list');
  }
#4
#5
#6

but at the Push method in ionic 3, back button creates automatically and follow a stack! This is not possible in Ionic 4?

#7

Exactly, not possible, as described in the documentation

#8

So, how can I add back button in Navbar. But, at the documentation shows the back button in there emulator. But, nothing says about these in there article!

#9

First navbar doesn’t exist in v4, only toolbar

Then as described in the doc or in the second link Ionic 4 Back Button (Angular) that should work