Ion-nav-back-button without parent view title

I man,

I’m trying to have a simple back button with a custom left arrow and without parent title.
My code is this

<body ng-controller="superController">
    <ion-nav-bar class="bar-positive" >
      <ion-nav-back-button class="button-clear" ng-click="myGoBack()">
        <img ng-src="{{ENV.CDNURL}}assets/buttons/back_btn.png">
      </ion-nav-back-button>
    </ion-nav-bar>
</body>

I tried with this with no result, parent view name is displayed in the nav bar

 $ionicConfigProvider.backButton.text('');

i tried also to customize the click event with ng-click=“myGoBack()” but view parent is displayed

.controller('superController',function ($scope,$ionicNavBarDelegate) {
  $scope.myGoBack = function () {
    $ionicNavBarDelegate.back();
  };
});

i recive an error like this:

TypeError: Illegal invocation
    at deprecatedWarning (http://localhost:8100/lib/ionic/js/ionic-angular.js:6173:13)
    at self.back (http://localhost:8100/lib/ionic/js/ionic-angular.js:6164:5)
    at http://localhost:8100/lib/ionic/js/ionic.js:98:46
    at Array.forEach (native)
    at DelegateInstance.caller [as back] (http://localhost:8100/lib/ionic/js/ionic.js:95:27)
    at Scope.$scope.myGoBack (http://localhost:8100/scripts/app.js:129:26)
    at $parseFunctionCall (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20124:18)
    at http://localhost:8100/lib/ionic/js/ionic-angular.js:9959:9
    at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22178:28)
    at Scope.$apply (http://localhost:8100/lib/ionic/js/ionic.bundle.js:22276:23)

I’m using this version of ionic:
“ionic”: “driftyco/ionic-bower#1.0.0-beta.14-nightly-935”,

Thank you,
Tommaso

You can change the ion-nav-back-button’s default icon and text:

$ionicConfigProvider.backButton.icon('ion-ios7-arrow-back');
$ionicConfigProvider.backButton.text('');
$ionicConfigProvider.backButton.previousTitleText(false);
2 Likes

@robf Thank you i wont custom back button, and for acheive this is enoug to put inside
some custom code.

For hiding parent title
$ionicConfigProvider.backButton.previousTitleText(false);

works great, where did you find that, In source code? i haven’t found in in doc!

It is in the docs:

-> http://ionicframework.com/docs/api/provider/$ionicConfigProvider/

Some times you need to use Google to find things in the docs:

e.g., Google -> “ionic framework $ionicConfigProvider”

ARG! I’m sure that i read more times the $ionicConfigProvider doc, but i haven’t found what i want!
Maybe for the API name!

@mhartington change

$ionicConfigProvider.backButton.previousTitleText();

in

$ionicConfigProvider.backButton.showPreviousTitleText();

:slight_smile: