[Ionic v4] Property 'push' does not exist on type 'NavController'.
See original GitHub issueI 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:
- Created 5 years ago
- Reactions:7
- Comments:13 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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(..)
becomesnavCtrl.goForward(..)
andnavCtrl.pop()
becausenavCtrl.goBackward(..)
Thanks @Devqon for this suggestion. However,
navCtrl.push(..)
andnavCtrl.goForward(..)
, even if they share the same intent, are very different :navCtrl.goForward(..)
the parameter is an url related to the part off the application you want to go, and withnavCtrl.goForward(..)
you directly use the class of the page to open.navCtrl.push(..)
was here to interact with old the old navigation system made by Ionic, andnavCtrl.goForward(..)
is here to facilitate the interaction with the Angular Routing system.