mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 21:15:24 +08:00
fix(navbar): go back text
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { Component, ElementRef, Input, Optional, Renderer, ViewChild } from '@angular/core';
|
import { Component, ElementRef, Input, Optional, Renderer } from '@angular/core';
|
||||||
|
|
||||||
import { App } from '../app/app';
|
import { App } from '../app/app';
|
||||||
import { Config } from '../../config/config';
|
import { Config } from '../../config/config';
|
||||||
@ -49,10 +49,8 @@ import { ViewController } from '../../navigation/view-controller';
|
|||||||
template:
|
template:
|
||||||
'<div class="toolbar-background" [ngClass]="\'toolbar-background-\' + _mode"></div>' +
|
'<div class="toolbar-background" [ngClass]="\'toolbar-background-\' + _mode"></div>' +
|
||||||
'<button (click)="backButtonClick($event)" ion-button="bar-button" class="back-button" [ngClass]="\'back-button-\' + _mode" [hidden]="_hideBb">' +
|
'<button (click)="backButtonClick($event)" ion-button="bar-button" class="back-button" [ngClass]="\'back-button-\' + _mode" [hidden]="_hideBb">' +
|
||||||
'<span class="button-inner">' +
|
'<ion-icon class="back-button-icon" [ngClass]="\'back-button-icon-\' + _mode" [name]="_bbIcon"></ion-icon>' +
|
||||||
'<ion-icon class="back-button-icon" [ngClass]="\'back-button-icon-\' + _mode" [name]="_bbIcon"></ion-icon>' +
|
'<span class="back-button-text" [ngClass]="\'back-button-text-\' + _mode">{{_backText}}</span>' +
|
||||||
'<span class="back-button-text" [ngClass]="\'back-button-text-\' + _mode" #bbTxt></span>' +
|
|
||||||
'</span>' +
|
|
||||||
'</button>' +
|
'</button>' +
|
||||||
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
|
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
|
||||||
'<ng-content select="ion-buttons[start]"></ng-content>' +
|
'<ng-content select="ion-buttons[start]"></ng-content>' +
|
||||||
@ -70,7 +68,7 @@ export class Navbar extends ToolbarBase {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ViewChild('bbTxt') _bbTxt: ElementRef;
|
_backText: string;
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -129,11 +127,9 @@ export class Navbar extends ToolbarBase {
|
|||||||
|
|
||||||
this._bbIcon = config.get('backButtonIcon');
|
this._bbIcon = config.get('backButtonIcon');
|
||||||
this._sbPadding = config.getBoolean('statusbarPadding');
|
this._sbPadding = config.getBoolean('statusbarPadding');
|
||||||
|
this._backText = config.get('backButtonText', 'Back');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
this.setBackButtonText(this._config.get('backButtonText', 'Back'));
|
|
||||||
}
|
|
||||||
|
|
||||||
backButtonClick(ev: UIEvent) {
|
backButtonClick(ev: UIEvent) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
@ -146,7 +142,7 @@ export class Navbar extends ToolbarBase {
|
|||||||
* Set the text of the Back Button in the Nav Bar. Defaults to "Back".
|
* Set the text of the Back Button in the Nav Bar. Defaults to "Back".
|
||||||
*/
|
*/
|
||||||
setBackButtonText(text: string) {
|
setBackButtonText(text: string) {
|
||||||
this._renderer.setText(this._bbTxt.nativeElement, text);
|
this._backText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user