1
- import { Component , ElementRef , Input , Optional , Renderer , ViewChild } from '@angular/core' ;
1
+ import { Component , ElementRef , Input , Optional , Renderer } from '@angular/core' ;
2
2
3
3
import { App } from '../app/app' ;
4
4
import { Config } from '../../config/config' ;
@@ -49,10 +49,8 @@ import { ViewController } from '../../navigation/view-controller';
49
49
template :
50
50
'<div class="toolbar-background" [ngClass]="\'toolbar-background-\' + _mode"></div>' +
51
51
'<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>' +
56
54
'</button>' +
57
55
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
58
56
'<ng-content select="ion-buttons[start]"></ng-content>' +
@@ -70,7 +68,7 @@ export class Navbar extends ToolbarBase {
70
68
/**
71
69
* @private
72
70
*/
73
- @ ViewChild ( 'bbTxt' ) _bbTxt : ElementRef ;
71
+ _backText : string ;
74
72
/**
75
73
* @private
76
74
*/
@@ -129,11 +127,9 @@ export class Navbar extends ToolbarBase {
129
127
130
128
this . _bbIcon = config . get ( 'backButtonIcon' ) ;
131
129
this . _sbPadding = config . getBoolean ( 'statusbarPadding' ) ;
130
+ this . _backText = config . get ( 'backButtonText' , 'Back' ) ;
132
131
}
133
132
134
- ngAfterViewInit ( ) {
135
- this . setBackButtonText ( this . _config . get ( 'backButtonText' , 'Back' ) ) ;
136
- }
137
133
138
134
backButtonClick ( ev : UIEvent ) {
139
135
ev . preventDefault ( ) ;
@@ -146,7 +142,7 @@ export class Navbar extends ToolbarBase {
146
142
* Set the text of the Back Button in the Nav Bar. Defaults to "Back".
147
143
*/
148
144
setBackButtonText ( text : string ) {
149
- this . _renderer . setText ( this . _bbTxt . nativeElement , text ) ;
145
+ this . _backText = text ;
150
146
}
151
147
152
148
/**
0 commit comments