From 79f0c90564a19812f4c8cd106a081fe9773b6887 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 19 Nov 2013 17:58:14 -0600 Subject: [PATCH] Tab bar fixes --- dist/js/ionic-angular.js | 26 +++++++++++++------ .../angular/src/directive/ionicNavRouter.js | 24 ++++++++++++----- js/ext/angular/src/directive/ionicTabBar.js | 2 +- js/ext/angular/test/navAndTabs.html | 2 +- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 56ca4faedc..9ce7f237b1 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -25494,12 +25494,9 @@ angular.module('ionic.ui.navRouter', []) $scope.currentTitle = data.title; } - if(typeof data.leftButtons !== 'undefined') { - $scope.leftButtons = data.leftButtons; - } - if(typeof data.rightButtons !== 'undefined') { - $scope.rightButtons = data.rightButtons; - } + $scope.leftButtons = data.leftButtons; + $scope.rightButtons = data.rightButtons; + if(typeof data.hideBackButton !== 'undefined') { $scope.enableBackButton = data.hideBackButton !== true; } @@ -25522,6 +25519,19 @@ angular.module('ionic.ui.navRouter', []) updateHeaderData(data); }); + $scope.$parent.$on('navRouter.titleChanged', function(e, data) { + var oldTitle = $scope.currentTitle; + $scope.oldTitle = oldTitle; + + if(data.animate !== false && typeof data.title !== 'undefined') { + animate($scope, $element, oldTitle, data, function() { + hb.align(); + }); + } else { + hb.align(); + } + }); + /* $scope.$parent.$on('navigation.push', function() { @@ -25582,7 +25592,7 @@ angular.module('ionic.ui.navRouter', []) var titleGet = $parse($attr.title); $scope.$watch(titleGet, function(value) { $scope.title = value; - $scope.$emit('navRouter.pageChanged', { + $scope.$emit('navRouter.titleChanged', { title: value, animate: $scope.animate }); @@ -26027,7 +26037,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) $scope.hideBackButton = $scope.$eval($attr.hideBackButton); if($scope.hideBackButton !== true) { - $scope.hideBackButton = true; + $scope.hideBackButton = false; } // Whether we should animate on tab change, also impacts whether we diff --git a/js/ext/angular/src/directive/ionicNavRouter.js b/js/ext/angular/src/directive/ionicNavRouter.js index 0c989eb9f3..95ac37bdc1 100644 --- a/js/ext/angular/src/directive/ionicNavRouter.js +++ b/js/ext/angular/src/directive/ionicNavRouter.js @@ -231,12 +231,9 @@ angular.module('ionic.ui.navRouter', []) $scope.currentTitle = data.title; } - if(typeof data.leftButtons !== 'undefined') { - $scope.leftButtons = data.leftButtons; - } - if(typeof data.rightButtons !== 'undefined') { - $scope.rightButtons = data.rightButtons; - } + $scope.leftButtons = data.leftButtons; + $scope.rightButtons = data.rightButtons; + if(typeof data.hideBackButton !== 'undefined') { $scope.enableBackButton = data.hideBackButton !== true; } @@ -259,6 +256,19 @@ angular.module('ionic.ui.navRouter', []) updateHeaderData(data); }); + $scope.$parent.$on('navRouter.titleChanged', function(e, data) { + var oldTitle = $scope.currentTitle; + $scope.oldTitle = oldTitle; + + if(data.animate !== false && typeof data.title !== 'undefined') { + animate($scope, $element, oldTitle, data, function() { + hb.align(); + }); + } else { + hb.align(); + } + }); + /* $scope.$parent.$on('navigation.push', function() { @@ -319,7 +329,7 @@ angular.module('ionic.ui.navRouter', []) var titleGet = $parse($attr.title); $scope.$watch(titleGet, function(value) { $scope.title = value; - $scope.$emit('navRouter.pageChanged', { + $scope.$emit('navRouter.titleChanged', { title: value, animate: $scope.animate }); diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js index 7c2d4b8a87..e7567fe9ba 100644 --- a/js/ext/angular/src/directive/ionicTabBar.js +++ b/js/ext/angular/src/directive/ionicTabBar.js @@ -110,7 +110,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) $scope.hideBackButton = $scope.$eval($attr.hideBackButton); if($scope.hideBackButton !== true) { - $scope.hideBackButton = true; + $scope.hideBackButton = false; } // Whether we should animate on tab change, also impacts whether we diff --git a/js/ext/angular/test/navAndTabs.html b/js/ext/angular/test/navAndTabs.html index 8bb4eaca27..598789e31d 100644 --- a/js/ext/angular/test/navAndTabs.html +++ b/js/ext/angular/test/navAndTabs.html @@ -17,7 +17,7 @@