diff --git a/js/angular/directive/tabNav.js b/js/angular/directive/tabNav.js index bf35658d552..7c7c07a31de 100644 --- a/js/angular/directive/tabNav.js +++ b/js/angular/directive/tabNav.js @@ -5,10 +5,10 @@ IonicModule replace: true, require: ['^ionTabs', '^ionTab'], template: - '' + '{{badge}}' + - '' + + '' + '' + '', scope: { @@ -57,35 +57,16 @@ IonicModule return tabsCtrl.selectedTab() === tabCtrl.$scope; }; - $scope.$watch("icon", function() { - styleTab(); - }); - - $scope.$watch("iconOff", function() { - styleTab(); - }); - - $scope.$watch("iconOn", function() { - styleTab(); - }); - - function styleTab() { - // check if tab if active + $scope.getIcon = function() { if ( tabsCtrl.selectedTab() === tabCtrl.$scope ) { - $element.addClass('tab-item-active'); - $element.find('i').removeClass($scope.getIconOff()); - $element.find('i').addClass($scope.getIconOn()); + // active + return $scope.iconOn || $scope.icon; } else { - $element.removeClass('tab-item-active'); - $element.find('i').removeClass($scope.getIconOn()); - $element.find('i').addClass($scope.getIconOff()); + // inactive + return $scope.iconOff || $scope.icon; } - } - - $scope.$on("tabSelected", styleTab); - - styleTab(); + }; } }; }]); diff --git a/test/html/tabs-starter.html b/test/html/tabs-starter.html index 101f6f41683..d84b0d7a870 100644 --- a/test/html/tabs-starter.html +++ b/test/html/tabs-starter.html @@ -93,7 +93,7 @@

Welcome to Ionic