How to change the label from back button in Ionic 2?

Viewed 23634

With the code:

<ion-navbar *navbar>
</ion-navbar>

the back button is enabled. But I need to customize it (the icon or the label). Is it possible? Can't find anything in the docs/api.

5 Answers

If you are using ionic 4 you can set back button text like this

<ion-back-button [text]="'<your text>'"></ion-back-button>

Here official documentation https://ionicframework.com/docs/v3/api/config/Config/

there is a good example of usage in the ionic 3 starter app

In costructor of app.component.ts is used "set" method used of Config object from ionic-angular:

this.config.set('ios', 'backButtonText', values.BACK_BUTTON_TEXT);

Is usefull when you want to use internationalization or if you want change configs dynamically:

this.translate.get(['BACK_BUTTON_TEXT']).subscribe(values => {
  this.config.set('ios', 'backButtonText', values.BACK_BUTTON_TEXT);
Related