How can I change the name of a button in an ionic structure?

In the Ionic Framework, I use this HTML structure in all of my views:

<ion-view view-title="Some title"> <ion-nav-buttons> </ion-nav-buttons> <ion-content> 

Then I get the "<Back" button generated automatically. However, sometimes this button has the word "Back" and sometimes has the name of the previous view.

Where and how can I change the behavior of the button header back?

+8
ionic-framework ionic
source share
2 answers

You should use $ionicConfigProvider :

 var myApp = angular.module('reallyCoolApp', ['ionic']); myApp.config(function($ionicConfigProvider) { $ionicConfigProvider.views.maxCache(5); // note that you can also chain configs $ionicConfigProvider.backButton.text('Go Back'); }); 

This example is from Ionic white papers.

To control the behavior of the "last type of text on the Back button, you can set backButton.previousTitleText(value) to false.

+14
source share

In Ionic Framework 2, you can now use the backButtonText configuration property set up to ''

 @NgModule({ declarations: [ MyApp ], imports: [ IonicModule.forRoot(MyApp, { backButtonText: '', }, {} )], bootstrap: [IonicApp], entryComponents: [ MyApp ], providers: [] }) 
+3
source share

All Articles