Skip to content

Ionic Back Button Not appearing if clicked on a link same as current route. #17445

Closed

Description

@arihantdaga

Bug Report

Ionic version:
[x] 4.0.0

Current behavior:

I have a sidebar application. in the side menu i have router links like this

<ion-menu-toggle auto-hide="false" *ngFor="let p of appPages">
<ion-item [routerDirection]="'root'" [routerLink]="[p.url]" lines="none">
              <ion-icon slot="start" [name]="p.icon"></ion-icon>
              <ion-label>
                {{p.title}}
              </ion-label>
</ion-item>
</ion-menu-toggle>
// appPages - 
appPages = [
    {
      title: 'Home',
      url: '/home',
      icon: 'home'
    },
    {
      title: 'Order History',
      url: '/myorders',
      icon: 'basket'
    }
]

I have pages like this -
Home Page
Order List Page
Order Detail Page

If i go from my orders list page to Order detail page by clicking an order it shows back button in order detail page. Thats expected behavior. Now, if i am in order list page and from side menu i again clicked on order list page(/myorders), after that when i click on an order, i am navigated to order detail page but ion back button is not appearing in the order detail page now.

Expected behavior:
Ion back button should appear in the order detail page.

Steps to reproduce:
Above pasted code should be sufficient.

Other information:

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.10.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.0.7
   @angular/cli                  : 7.0.7
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.4, browser 4.1.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 8 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/xman/Library/Android/sdk)
   NodeJS            : v10.15.1 (/usr/local/bin/node)
   npm               : 6.4.1
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61

Activity

  1. liamdebeasi commented on Feb 15, 2019

    @liamdebeasi
    Contributor

    Hi there,

    As of Ionic 4, the back button is not added by default to the navigation bar. Here is a link to the list of breaking changes, along with an example of how to include the back button: https://github.com/ionic-team/ionic/blob/master/angular/BREAKING.md#back-button

    You'll need to explicitly include the back button on every page that you want it to show up on. Let me know if you are still running into issues after trying that. Thanks!

  2. added
    needs: reply
    on Feb 15, 2019
  3. arihantdaga commented on Feb 17, 2019

    @arihantdaga
    Author

    I did include the in the page. And then somewhere i read about the new back button that is smart enough to know when to show the button or not based on location history. But if router direction is root - a.k.a. [routerDirection]="'root'" Then if we click the same link where we are right now, after that whatever page we navigateForward to , it doesnt show the back button in that next page, while it should have.

  4. added and removed
    needs: reply
    on Feb 17, 2019
  5. liamdebeasi commented on Feb 18, 2019

    @liamdebeasi
    Contributor

    Thanks for the additional info! Would you be able to provide a repository that has the code necessary to reproduce this issue?

    Thanks!

  6. added
    needs: reply
    on Feb 18, 2019
  7. juanparadox commented on Mar 7, 2019

    @juanparadox

    I'm having the same issue. I have a list of items that all have an href. I click on an item, navigate to the page, then hit the back button in the UI to go back to the list. If I click on the same item again the animation comes in from the left instead of the right and the back button is gone.

  8. added and removed
    needs: reply
    on Mar 7, 2019
  9. added
    needs: reply
    on Mar 7, 2019
  10. juanparadox commented on Mar 23, 2019

    @juanparadox

    I got my back button to start showing again by ditching the href attribute and using routerLink and routerDirection="forward" (in this case I was going forwards and then backwards). This no longer removes my back button when revisiting a page.

  11. added and removed
    needs: reply
    on Mar 23, 2019
  12. liamdebeasi commented on Mar 29, 2019

    @liamdebeasi
    Contributor

    Hi @juanparadox,

    Are you able to provide a repository with the code required to reproduce this issue?

    Thanks!

  13. added
    needs: reply
    on Mar 29, 2019
  14. ionitron-bot commented on Apr 28, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

    Thank you for using Ionic!

  15. locked and limited conversation to collaborators on Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: reply

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions