Ionic version 5 support Stack (Push /Pop) based navigation approach

Does ionic version 5 has back ward compatibility for stack based (Push/pop -Nav controller) approach ? Could you please confirm

1 Like

NavController has a bunch of methods which should replicate what you need. Check the type definitions for navigateForward(), navigateBack(), pop(), back() and navigateRoot(). I’m not sure what navigation you’d need to do that isn’t covered by any of these.

Actually we are planning to migrate from ionic 3 to ionic 5 and we were using push/ pop approach for page navigation ( nab controller- push and pop methods of ionic 3) We don’t want to change
to routers since bringing in routers have major changes across the app. So we would like to know whether this push pop approach is still supported in ionic 5. Please suggest. Thanks

You could just write a proxy controller which executes push() and pop() how you wish and then inject the proxy controller under the same name in your service and components. From the development perspective nothing really changes. But if you’re looking to upgrade from v3 to v5 without any code refactoring at all I think you’ll struggle.

Thanks, definitely we are refractoring the code otherwise it is a whole struggle.
One more question, creating a new v5 ionic app and port all features would be ideal than applying the version upgrade in existing package.json and resolving conflicts.

I guess it depends on the size of your codebase. Either would work but yes chances are there would be a lot more conflicts to resolve if you upgraded from npm.

I would suggest u to start a new app from scratch and port ur code and plugins in, as for the push, pop nav controller in ionic 5 can help u a little but imho port the navigation to routing as in angular that will help u a lot in future development of ur app. it is a headache of one time but worth it.

We are planning to take this upgrade in phases and migration to routing we planned for the second phase. So was thinking to keep this push /pop page approach for the first phase with ionic 5 migration, hopefully it is possbile.

yeah , we are planning to create a new app and port features. The only problem is how we can tweak the push /pop pages navigation. so that routing can be taken up in phases