From d3c8a1b2a4a87c20639f11a2402c68b4e740db6f Mon Sep 17 00:00:00 2001 From: Perry Govier Date: Fri, 5 Sep 2014 16:01:59 -0500 Subject: [PATCH] fix(back button): do not animate back button transition if the title doesn't change. Fixes #1858 --- js/angular/controller/navBarController.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/angular/controller/navBarController.js b/js/angular/controller/navBarController.js index a08f566f93..c5cfc61012 100644 --- a/js/angular/controller/navBarController.js +++ b/js/angular/controller/navBarController.js @@ -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);