pisapapiros pisapapiros - 3 months ago 54
AngularJS Question

Ionic back button translation

I can customize the back button text in my Ionic project like this:

.config(
function ($ionicConfigProvider) {
$ionicConfigProvider.backButton.text("Back");
}
})


Now I'm trying to translate it. I use angular-translate in my project:

$ionicConfigProvider.backButton.text($filter('translate')('BACK'));


But the translate filter seems to be unavailable during config phase. Is there any way of overcoming this issue or any better way of translating the back-button text?

Update: please note this is not about how to use the translate filter during config phase, but how to translate the back button properly.

Thanks in advance

Answer

You can change the text of the back button threw the HTML:

<ion-nav-back-button class="button-clear">
  <i class="icon ion-ios7-arrow-back"></i> 
   Back
</ion-nav-back-button>

To use Angular-translate:

<ion-nav-back-button class="button-clear">
  <i class="icon ion-ios7-arrow-back"></i> 
  {{'BACK' | translate}}
</ion-nav-back-button>
Comments