Ionic 4, using old navigation?

#1

So I am trying to convert my application to ionic v4. Got the lint errors done, and most of the compile errors.

I have alot of modals that i previously did

this.viewCtrl.dismiss(this.data)

ViewController is moved to @ionic/core and dismiss no longer exists, what is the alternative?

Also, som guides states you can still use navController.push / pop, but how? Are they moved?

I will eventually move to the new router, but was hoping to delay that unitl i got it compiled.

Thanks

#2

You can access the dismiss method through the ModalController to dismiss a modal in v4. I’m not sure what the current recommended approach is for those who want to stick with push/pop navigation. The push/pop methods are available through the <ion-nav> web component directly.

It might just be easier to switch to Angular routing.

1 Like
#3

Thank you.

One more thing, is it documented how i include CUSTOM_ELEMENTS_SCHEMA?

  1. If ‘ion-input’ is an Angular component and it has ‘ngModel’ input, then verify that it is part of this module.
  2. If ‘ion-input’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
  3. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component.
#4

You shouldn’t need to include CUSTOM_ELEMENTS_SCHEMA, Ionic web components should just work by default when you generate a V4 application.

If you’re getting that error perhaps you are missing the IonicModule import from one of your modules.

#5

I see, currently i have only one module in the app (app.modules.ts).

Do i need one module per component with v4?

#6

That depends how you’re setting it up, but if you are using lazy loading then each page would have its own module. Are you attempting to convert an existing project from Ionic 3 to Ionic 4? I think you would have an easier time creating a fresh new Ionic 4 project and copying stuff over as you go - the starters and generators set up most of this stuff for you.

#7

Correct.

Was hoping to avoid converting to the new project structure just yet, since i got alot of components in this project, and i will probably make changes in the v3 branch for some time still until v4 is production ready. But probably the best approach. Thanks

#8

Switching to angular routing is not that easy at least in our project, any idea make ionic routing work in v4?
We have a problem with view.getNav().