fix(back button): do not animate back button transition if the title doesn't change. Fixes #1858

This commit is contained in:
Perry Govier
2014-09-05 16:01:59 -05:00
parent 69442d5a8e
commit d3c8a1b2a4

View File

@@ -16,6 +16,10 @@ function($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionic
$scope.$on('$destroy', deregisterInstance);
$scope.$on('$viewHistory.historyChange', function(e, data) {
backIsShown = !!data.showBack;
});
var self = this;
this.leftButtonsElement = jqLite(
@@ -60,6 +64,10 @@ function($scope, $element, $attrs, $ionicViewService, $animate, $compile, $ionic
this.changeTitle = function(title, direction) {
if ($scope.title === title) {
// if we're not animating the title, but the back button becomes invisible
if(typeof backIsShown != 'undefined' && !backIsShown && $scope.backButtonShown){
jqLite($element[0].querySelector('.back-button')).addClass('ng-hide');
}
return false;
}
this.setTitle(title);