如何在离子框架中更改后退按钮标题? [英] How can I change the back button title in ionic framework?

查看:116
本文介绍了如何在离子框架中更改后退按钮标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ionic Framework中,我在所有视图上使用此HTML结构:

In Ionic Framework, I use this HTML structure on all my views:

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

然后我会自动生成一个< Back按钮。但是,有时此按钮具有单词Back,有时它具有上一个视图的名称。

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

我在哪里以及如何更改后退按钮标题的行为?

Where and how can I change how the back button title behaves?

推荐答案

你应该使用 $ 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');
});

此示例来自官方Ionic文档。

This example is from the official Ionic docs.

要控制后退按钮上的最后一个视图文本的行为,您可以将 backButton.previousTitleText(value)设置为false。

To control the behaviour of the "last view text on back button" you could set backButton.previousTitleText(value) to false.

这篇关于如何在离子框架中更改后退按钮标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆