How to detect if a component is viewed from modal, popover controller or as page?

I have a component with a Ionic header. This header has a ion-back-button and a button on the left to close.

The ion-back-button should only be displayed if this components is viewed as page. It works if I remove the defaultHref attribute. But I only want to display the close-button if it is a modal or popover.

Is there a way to detect how is a component viewed / used? e.g. to hide the close button in the header if it’s viewed as page or inversed logic (display if modal / popover).

I could pass params. But I prefer another way.