[ionic4] ion-back-button default-href not working

So I have this url:

https://todo-ionic.thehangrycoder.now.sh/todo/new

normally you get to this page via

https://todo-ionic.thehangrycoder.now.sh/todo/

Then the detail page will have a back button, going back to the Todo overview.

But when you go directly to https://todo-ionic.thehangrycoder.now.sh/todo/new … it still shows the back button, but when pressed, it doesn’t do anything.

I’m using the default-href:

    <ion-buttons slot="start">
      <ion-back-button default-href="/todo"></ion-back-button>
    </ion-buttons>

The complete project is found at : https://github.com/fransyozef/todo-challenge/tree/master/frontend/ionic4/todo-app

The ts and html for the page: https://github.com/fransyozef/todo-challenge/tree/master/frontend/ionic4/todo-app/src/app/todo/todo-detail

You have to change default-href for defaultHref

<ion-buttons slot="start">
      <ion-back-button defaultHref="home"></ion-back-button>
</ion-buttons>

See more https://ionicframework.com/docs/api/back-button

1 Like