How to show ion-menu-button or ion-back-button based on the sorce page?

Hi,
I have a side menu app done with Ionic4.
PageX is reachable both from the side menu and some pages of the app.

I’d like to show in this page (PageX), a header with the button:

<ion-menu-button></ion-menu-button>

if I reached the page from the side menu.

I’d like to show a header with the button:

<ion-back-button></ion-back-button>

If I reached the page from another page, not the side menu.

A solution could be to pass a parameter when I open the page.
There are smarter solutions according to you?

Thank you

Claudio

Yes you are going to have to send a parameter over, the use that value to resolve the *ngIF that will be add to those two components.

However, there might be something the Ionic’s router might have trouble with, so be warned.

1 Like