Skip to content

Commit

Permalink
fix(navbar): go back text
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Nov 27, 2016
1 parent d82bb01 commit 58189d2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/components/navbar/navbar.ts
Original file line number Diff line number Diff line change
@@ -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 { Config } from '../../config/config';
Expand Down Expand Up @@ -49,10 +49,8 @@ import { ViewController } from '../../navigation/view-controller';
template:
'<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">' +
'<span class="button-inner">' +
'<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>' +
'<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>' +
'</button>' +
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
'<ng-content select="ion-buttons[start]"></ng-content>' +
Expand All @@ -70,7 +68,7 @@ export class Navbar extends ToolbarBase {
/**
* @private
*/
@ViewChild('bbTxt') _bbTxt: ElementRef;
_backText: string;
/**
* @private
*/
Expand Down Expand Up @@ -129,11 +127,9 @@ export class Navbar extends ToolbarBase {

this._bbIcon = config.get('backButtonIcon');
this._sbPadding = config.getBoolean('statusbarPadding');
this._backText = config.get('backButtonText', 'Back');
}

ngAfterViewInit() {
this.setBackButtonText(this._config.get('backButtonText', 'Back'));
}

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

/**
Expand Down

0 comments on commit 58189d2

Please sign in to comment.