Ionic 4 ionViewWillLeave equivalent

Hi, what’s the equivalent to ionViewWillLeave in ionic v4?

1 Like

Which version are you using?

I’m using 4.1.2 and ionWillViewLeave works. It pops up after the other page has loaded though. Looks like a delay.

    console.log('Leaving Sign in Page');


It’s a bit confusing, but framework and CLI versions are totally unrelated. OP is asking about framework v4, and you’re talking about the CLI version.

First thing I would try is CanDeactivate.

In Ionic v4 ionViewWillLeave still exists

For reference:

I think the confusion comes from the documentation which could be a bit misleading, according the amount of question about this subject. The only lifecycle, as far as I know, which doesn’t exist in v4 anymore is ionViewDidLoad, this has to be replaced with ngOnInit


thank you, you are right

What about Ionic 5? I’m having a hard time with the docs