question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Ionic v4] Property 'push' does not exist on type 'NavController'.

See original GitHub issue

I know a lot have changed with Navigation in Ionic 4, and the NavController is not the same.

However, in the official migration guide, it is stated that the old NavController from Ionic 3 could still be used for backward compatibility.

If I understand correctly, in a fresh Ionic 4 project, the new NavController is imported by default. So for instance when I write this code :

this.navCtrl.push(ProductDetailPage, {'product' : product});

I end up with this error

Property ‘push’ does not exist on type ‘NavController’.

How can we use the old NavController in a Ionic 4 project ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
Devqoncommented, Aug 7, 2018

I think what they mean with ‘backward compatibility’, is that you can still use the NavController. The function names however have been changed. navCtrl.push(..) becomes navCtrl.goForward(..) and navCtrl.pop() because navCtrl.goBackward(..)

5reactions
nilebmacommented, Aug 9, 2018

Thanks @Devqon for this suggestion. However, navCtrl.push(..) and navCtrl.goForward(..), even if they share the same intent, are very different :

  • their signatures are not the same, with navCtrl.goForward(..) the parameter is an url related to the part off the application you want to go, and with navCtrl.goForward(..) you directly use the class of the page to open.
  • they do different things : the navCtrl.push(..) was here to interact with old the old navigation system made by Ionic, and navCtrl.goForward(..) is here to facilitate the interaction with the Angular Routing system.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Property 'push' does not exist on type 'NavController' in Angular
I'm building Ionic app and I need ...
Read more >
[ts] Property 'push' does not exist on type 'NavController'
I'm trying a simple example in: CLI PRO 4.2.1 and v4-beta. Then, I have one page, in the sidemenu app. import { Component...
Read more >
ionic 4 get current page, property 'push does not exist on type ...
It's used underneath NavController so it will never have to be interacted with directly. When a new page is pushed with NavController, the...
Read more >
[ts] Property 'push' does not exist on type ... - Ionic Forum
Then, I have one page, in the sidemenu app. import { Component } from '@angular/core'; import { NavController, AlertController, LoadingController } from '@ionic...
Read more >
NavController - Ionic API Documentation
Pages are created when they are added to the navigation stack. For methods like push(), the NavController takes any component class that is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found