Hello Guys, I have a weird issue here
I just need to have a back button in my header, I see a lot of Google results and documentation examples…
Problem 1: My Header is it… But the ion-nav-back-button
is not shown (for something that I don’t know)
<ion-header-bar class="bar bar-header bar-positive">
<ion-nav-back-button class="button-clear">
<i class="ion-arrow-left-c"></i> Back
</ion-nav-back-button>
<h1 class="title">Post</h1>
</ion-header-bar>
Problem 2: I tried to solve this, using a hardcoded back button, in this way:
<ion-header-bar class="bar bar-header bar-positive">
<a class="button icon-left ion-ios7-arrow-back button-clear" ng-click="backButton()"></a>
<h1 class="title">Post</h1>
</ion-header-bar>
And, in the controller:
.controller('postCtrl', function ($scope, $stateParams, $ionicNavBarDelegate) {
$scope.backButton = function() {
console.log('back');
$ionicNavBarDelegate.back();
};
})
And when I click, I see the log in console but the back function not work ://
WTH I’m doing wrong guys?
Sometimes I have a error on console:
Error: [$compile:ctreq] Controller ‘ionNavBar’, required by directive ‘ionNavBackButton’, can’t be found!
Problem 3: I changed my code to use ion-nav-bar
, but just work if I navigate to 3 pages…
1 - home state -> Click to post state
2 - post state -> (dont show back btn) Click to home state
3 - home state -> Click to post state
4 - post state -> Now the back button is been shown
<ion-nav-bar class="bar bar-header bar-positive">
<ion-nav-back-button class="button-clear">
<i class="ion-arrow-left-c"></i> Back
</ion-nav-back-button>
</ion-nav-bar>
=s
I’m using the release v1.0.0-beta.5b