fix(navbar): go back text

This commit is contained in:
Manu Mtz.-Almeida
2016-11-27 20:13:32 +01:00
parent d82bb01505
commit 58189d27a9

View File

@ -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" #bbTxt></span>' + '<span class="back-button-text" [ngClass]="\'back-button-text-\' + _mode">{{_backText}}</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;
} }
/** /**