From bb6976ad54736103d78be3bddd9faf7719dc0153 Mon Sep 17 00:00:00 2001 From: Perry Govier Date: Wed, 9 Jul 2014 17:10:43 -0500 Subject: [PATCH] feat(tab): options 'hidden' attribute for tabs. Closes #1666, #1673 --- js/angular/directive/tab.js | 1 + js/angular/directive/tabNav.js | 8 +++++++- scss/_tabs.scss | 3 +++ test/html/tabs.html | 11 ++++++++++- test/unit/angular/directive/tabs.unit.js | 10 +++++++--- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/js/angular/directive/tab.js b/js/angular/directive/tab.js index db06203e4b..5d913a4258 100644 --- a/js/angular/directive/tab.js +++ b/js/angular/directive/tab.js @@ -68,6 +68,7 @@ function($rootScope, $animate, $ionicBind, $compile) { attrStr('icon-off', attr.iconOff) + attrStr('badge', attr.badge) + attrStr('badge-style', attr.badgeStyle) + + attrStr('hidden', attr.hidden) + attrStr('class', attr['class']) + '>'; diff --git a/js/angular/directive/tabNav.js b/js/angular/directive/tabNav.js index 331f605251..e1e0d082ac 100644 --- a/js/angular/directive/tabNav.js +++ b/js/angular/directive/tabNav.js @@ -5,7 +5,7 @@ IonicModule replace: true, require: ['^ionTabs', '^ionTab'], template: - '' + '{{badge}}' + '' + @@ -18,6 +18,7 @@ IonicModule iconOn: '@', iconOff: '@', badge: '=', + hidden: '@', badgeStyle: '@', 'class': '@' }, @@ -41,6 +42,11 @@ IonicModule }); } + $scope.isHidden = function() { + if($attrs.hidden === 'true' || $attrs.hidden === true)return true; + return false; + }; + $scope.getIconOn = function() { return $scope.iconOn || $scope.icon; }; diff --git a/scss/_tabs.scss b/scss/_tabs.scss index 945dd82b4c..b340d8541b 100644 --- a/scss/_tabs.scss +++ b/scss/_tabs.scss @@ -185,6 +185,9 @@ &:hover { cursor: pointer; } + &.tab-hidden{ + display:none; + } } .tabs-item-hide > .tabs, diff --git a/test/html/tabs.html b/test/html/tabs.html index 32fbb8872e..8ea56c2810 100644 --- a/test/html/tabs.html +++ b/test/html/tabs.html @@ -97,6 +97,15 @@ + + -