diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js
index 25bf14cb04..494d07a193 100644
--- a/js/ext/angular/src/directive/ionicTabBar.js
+++ b/js/ext/angular/src/directive/ionicTabBar.js
@@ -135,7 +135,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view', 'ionic.ui.bindHtml'])
}])
// Generic controller directive
-.directive('tab', ['$ionicViewService', '$rootScope', '$parse', function($ionicViewService, $rootScope, $parse) {
+.directive('tab', ['$ionicViewService', '$rootScope', '$parse', '$interpolate', function($ionicViewService, $rootScope, $parse, $interpolate) {
return {
restrict: 'E',
require: '^tabs',
@@ -169,10 +169,14 @@ angular.module('ionic.ui.tabs', ['ionic.service.view', 'ionic.ui.bindHtml'])
// tell any parent nav controller to animate
$scope.animate = $scope.$eval($attr.animate);
- var badge = $parse($attr.badge);
- $scope.$watch(badge, function(value) {
+ var badgeGet = $parse($attr.badge);
+ $scope.$watch(badgeGet, function(value) {
$scope.badge = value;
});
+ var badgeStyleGet = $interpolate(attr.badgeStyle || '');
+ $scope.$watch(badgeStyleGet, function(val) {
+ $scope.badgeStyle = val;
+ });
var leftButtonsGet = $parse($attr.leftButtons);
$scope.$watch(leftButtonsGet, function(value) {
@@ -246,7 +250,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view', 'ionic.ui.bindHtml'])
replace: true,
scope: true,
template: '
' +
- '' +
+ '' +
'
',
link: function($scope, $element, $attr, tabsCtrl) {
$element.addClass($scope.tabsType);
@@ -266,6 +270,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view', 'ionic.ui.bindHtml'])
iconOn: '@',
iconOff: '@',
badge: '=',
+ badgeStyle: '=',
active: '=',
tabSelected: '@',
index: '='
@@ -281,7 +286,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view', 'ionic.ui.bindHtml'])
},
template:
'' +
- '{{badge}}' +
+ '{{badge}}' +
'' +
'' +
'' +
diff --git a/js/ext/angular/test/directive/ionicTabBar.unit.js b/js/ext/angular/test/directive/ionicTabBar.unit.js
index 1bdb4d35ba..7a341bccdc 100644
--- a/js/ext/angular/test/directive/ionicTabBar.unit.js
+++ b/js/ext/angular/test/directive/ionicTabBar.unit.js
@@ -137,8 +137,9 @@ describe('Tab Item directive', function() {
scope = $rootScope;
scope.badgeValue = 3;
+ scope.badgeStyle = 'badge-assertive';
element = compile('' +
- '' +
+ '' +
'')(scope);
scope.$digest();
$document[0].body.appendChild(element[0]);
@@ -158,9 +159,9 @@ describe('Tab Item directive', function() {
it('Badge works', function() {
scope.$digest();
- var i = element[0].querySelectorAll('i')[0];
- expect(angular.element(i).hasClass('badge')).toEqual(true);
+ var i = element[0].querySelector('.badge');
expect(i.innerHTML).toEqual('3');
+ expect(i.className).toMatch('badge-assertive');
});
it('Badge updates', function() {
@@ -192,7 +193,7 @@ describe('Tab Controller Item directive', function() {
scope.badgeValue = 3;
scope.isActive = false;
element = compile('' +
- '' +
+ '' +
'')(scope);
scope.$digest();
$document[0].body.appendChild(element[0]);
@@ -223,9 +224,13 @@ describe('Tab Controller Item directive', function() {
it('Badge updates', function() {
scope.badgeValue = 10;
+ scope.badgeStyle = 'badge-assertive';
scope.$digest();
- var i = element[0].querySelectorAll('i')[0];
+ var i = element[0].querySelector('.badge');
expect(i.innerHTML).toEqual('10');
+ expect(i.className).toMatch('badge-assertive');
+ scope.$apply('badgeStyle = "badge-super"');
+ expect(i.className).toMatch('badge-super');
});
});
diff --git a/js/ext/angular/test/tabs.html b/js/ext/angular/test/tabs.html
index 37c1b94446..db9ce7c559 100644
--- a/js/ext/angular/test/tabs.html
+++ b/js/ext/angular/test/tabs.html
@@ -6,8 +6,8 @@