Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 83ceb78

Browse files
bekosajoslin
authored andcommitted
fix(tabs): use interpolation for type attribute
Closes #1409 BREAKING CHANGE: Use interpolation for type attribute. Before: <tabset type="'pills'" ...></tabset > or <tabset type="navtype" ...></tabset> After: <tabset type="pills" ...></tabset> or <tabset type="{{navtype}}" ...></tabset>
1 parent 7727341 commit 83ceb78

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

src/tabs/docs/demo.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<hr />
2626

27-
<tabset vertical="true" type="navType">
27+
<tabset vertical="true" type="pills">
2828
<tab heading="Vertical 1">Vertical content 1</tab>
2929
<tab heading="Vertical 2">Vertical content 2</tab>
3030
</tabset>

src/tabs/docs/demo.js

-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ var TabsDemoCtrl = function ($scope) {
99
alert('You\'ve selected the alert tab!');
1010
});
1111
};
12-
13-
$scope.navType = 'pills';
1412
};

src/tabs/tabs.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ angular.module('ui.bootstrap.tabs', [])
8282
restrict: 'EA',
8383
transclude: true,
8484
replace: true,
85-
scope: {},
85+
scope: {
86+
type: '@'
87+
},
8688
controller: 'TabsetController',
8789
templateUrl: 'template/tabs/tabset.html',
8890
link: function(scope, element, attrs) {
8991
scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false;
9092
scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false;
91-
scope.type = angular.isDefined(attrs.type) ? scope.$parent.$eval(attrs.type) : 'tabs';
9293
}
9394
};
9495
})

src/tabs/test/tabs.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ describe('tabs', function() {
398398
beforeEach(inject(function($controller, $rootScope) {
399399
scope = $rootScope;
400400
//instantiate the controller stand-alone, without the directive
401-
ctrl = $controller('TabsetController', {$scope: scope, $element: null});
401+
ctrl = $controller('TabsetController', {$scope: scope});
402402
}));
403403

404404

@@ -609,7 +609,7 @@ describe('tabs', function() {
609609
scope = $rootScope.$new();
610610
scope.navType = 'pills';
611611

612-
elm = $compile('<tabset type="navType"></tabset>')(scope);
612+
elm = $compile('<tabset type="{{navType}}"></tabset>')(scope);
613613
scope.$apply();
614614
}));
615615

template/tabs/tabset.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
<div class="tabbable">
3-
<ul class="nav {{type && 'nav-' + type}}" ng-class="{'nav-stacked': vertical, 'nav-justified': justified}" ng-transclude></ul>
3+
<ul class="nav nav-{{type || 'tabs'}}" ng-class="{'nav-stacked': vertical, 'nav-justified': justified}" ng-transclude></ul>
44
<div class="tab-content">
55
<div class="tab-pane"
66
ng-repeat="tab in tabs"

0 commit comments

Comments
 (0)