Skip to content

feat: Add backButton defaultHref for the config of IonicModule. #19305

@Domvel

Description

@Domvel

Feature Request

Ionic version:
[x] 4.x

Describe the Feature Request
Currently there is a defaultHref attribute for the ion-back-button to always show a back-button. Also if there is no router history. It's important to emergency exit the page if there is a router issue. e.g. on page-reload.
The defaultHref attribut should be in the configuration at app.module.ts IonicModule.forRoot({ backButtonDefaultHref: "" }). Why? In my case I have to add the attribute in every single page. Always the same value.

Currently there are already to config properties for the back button: 'backButtonText' and backButtonIcon. And now just add the backButtonDefaultHref.
Note: If backButtonText is still set directly on in html, it should be used instead of the default config. Always use the html attribute first. But I think, this is the current behavior of such config at IonicModule, isn't?

Describe Preferred Solution
I do not want to set the defaultHref to each back-button.
Therefore I want to set it in the IonicModule forRoot config object in app.module.ts.
This is only the default value for all back-buttons. If the attribute defaultHref is still set on the html element, it will overwrite the default configuration for this element.
This is just an additional property for the config object. backButtonText and backButtonIcon already exist. I think backButtonDefaultHref should also be added here.
What do you think? Maybe we missed it? Or is there another reson?

Describe Alternatives
I don't think that there is an alternative. Add it as optional config property for IonicModule or not. Otherwise I have to set it to each html page.

Related Code
app.module.ts

IonicModule.forRoot({
  backButtonDefaultHref: ''
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanteda good issue for the communitypackage: core@ionic/core packagetype: feature requesta new feature, enhancement, or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions