Skip to content

Commit 58189d2

Browse files
committed
fix(navbar): go back text
1 parent d82bb01 commit 58189d2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/components/navbar/navbar.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ElementRef, Input, Optional, Renderer, ViewChild } from '@angular/core';
1+
import { Component, ElementRef, Input, Optional, Renderer } from '@angular/core';
22

33
import { App } from '../app/app';
44
import { Config } from '../../config/config';
@@ -49,10 +49,8 @@ import { ViewController } from '../../navigation/view-controller';
4949
template:
5050
'<div class="toolbar-background" [ngClass]="\'toolbar-background-\' + _mode"></div>' +
5151
'<button (click)="backButtonClick($event)" ion-button="bar-button" class="back-button" [ngClass]="\'back-button-\' + _mode" [hidden]="_hideBb">' +
52-
'<span class="button-inner">' +
53-
'<ion-icon class="back-button-icon" [ngClass]="\'back-button-icon-\' + _mode" [name]="_bbIcon"></ion-icon>' +
54-
'<span class="back-button-text" [ngClass]="\'back-button-text-\' + _mode" #bbTxt></span>' +
55-
'</span>' +
52+
'<ion-icon class="back-button-icon" [ngClass]="\'back-button-icon-\' + _mode" [name]="_bbIcon"></ion-icon>' +
53+
'<span class="back-button-text" [ngClass]="\'back-button-text-\' + _mode">{{_backText}}</span>' +
5654
'</button>' +
5755
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
5856
'<ng-content select="ion-buttons[start]"></ng-content>' +
@@ -70,7 +68,7 @@ export class Navbar extends ToolbarBase {
7068
/**
7169
* @private
7270
*/
73-
@ViewChild('bbTxt') _bbTxt: ElementRef;
71+
_backText: string;
7472
/**
7573
* @private
7674
*/
@@ -129,11 +127,9 @@ export class Navbar extends ToolbarBase {
129127

130128
this._bbIcon = config.get('backButtonIcon');
131129
this._sbPadding = config.getBoolean('statusbarPadding');
130+
this._backText = config.get('backButtonText', 'Back');
132131
}
133132

134-
ngAfterViewInit() {
135-
this.setBackButtonText(this._config.get('backButtonText', 'Back'));
136-
}
137133

138134
backButtonClick(ev: UIEvent) {
139135
ev.preventDefault();
@@ -146,7 +142,7 @@ export class Navbar extends ToolbarBase {
146142
* Set the text of the Back Button in the Nav Bar. Defaults to "Back".
147143
*/
148144
setBackButtonText(text: string) {
149-
this._renderer.setText(this._bbTxt.nativeElement, text);
145+
this._backText = text;
150146
}
151147

152148
/**

0 commit comments

Comments
 (0)