From ec7bf2026b10c01d92d52a09abb63ad81ef46045 Mon Sep 17 00:00:00 2001 From: Abruzzi Date: Tue, 3 Mar 2015 23:00:21 +0800 Subject: [PATCH] fix: initialize $scope.$tabSelected when nested tabs selected. Like the issue #1276 if you have some nested tabs, you select a sub-tab item, and you will active some other siblings, because when tabCtrl add every new $scope, it does't has a initial attr $scope.$tabSelected, so every unselected item will read the $tabSelected from inherited $parent, but if the parent-tab has been actived, the all of its sub-tabs will read this true property in $scope.$tabSelected. So I think we should initialize the property $scope.$tabSelected before invoking tabsCtrl.add(), and every tab-item will has a 'false' status for a initial $scope.$tabSelected. --- js/angular/directive/tab.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/angular/directive/tab.js b/js/angular/directive/tab.js index 1ef29b65412..4634f76d741 100644 --- a/js/angular/directive/tab.js +++ b/js/angular/directive/tab.js @@ -100,6 +100,7 @@ function($compile, $ionicConfig, $ionicBind, $ionicViewSwitcher) { var tabsCtrl = ctrls[0]; var tabCtrl = ctrls[1]; var isTabContentAttached = false; + $scope.$tabSelected = false; $ionicBind($scope, $attr, { onSelect: '&',