feat(back-button): add 'backButtonDefaultHref' property to Ionic Config (#20491)

closes #19305

Co-authored-by: Brandy Carney <brandy@ionic.io>
This commit is contained in:
EinfachHans
2020-04-27 16:57:43 +02:00
committed by GitHub
parent 32ecdd6753
commit 1b11ff7fb9
5 changed files with 55 additions and 4 deletions

View File

@ -31,7 +31,7 @@ export class BackButton implements ComponentInterface, ButtonInterface {
/**
* The url to navigate back to by default when there is no history.
*/
@Prop() defaultHref?: string;
@Prop({ mutable: true }) defaultHref?: string;
/**
* If `true`, the user cannot interact with the button.
@ -53,6 +53,12 @@ export class BackButton implements ComponentInterface, ButtonInterface {
*/
@Prop() type: 'submit' | 'reset' | 'button' = 'button';
componentWillLoad() {
if (this.defaultHref === undefined) {
this.defaultHref = config.get('backButtonDefaultHref');
}
}
get backButtonIcon() {
const icon = this.icon;
if (icon != null) {