Search code examples
angularionic-frameworkionic4

Ionic back button whitout defaultHref


I have this code :

<ion-back-button (click)="backClick()" *ngSwitchCase="1"></ion-back-button>

in my backClick I have :

this.back.emit({currentStep: 1});

The idea is that I want to emit an event when click on ion-back-button. And after that redirect to an url. But whitout defaultHref the arrow back is not displayed. From what I saw is not possible to do this kind of manipulations using ion-back-button ?

Thx in advancen abd sorry for my english.


Solution

  • my friend, There should be a defaultHref when you use the back button, If not, the icon will not be displayed, this link is the official documentation. (-;

    An example:

    <ion-header>
      <ion-toolbar>
        <ion-buttons>
          <ion-back-button defaultHref="/yourlink"></ion-back-button>
        </ion-buttons>
        <ion-title>Your title</ion-title>
      </ion-toolbar>
    </ion-header>
    
    <ion-content>
    ...
    </ion-content>