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

fix(tabs): use interpolation for type attribute #1459

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tabs/docs/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<hr />

<tabset vertical="true" type="navType">
<tabset vertical="true" type="pills">
<tab heading="Vertical 1">Vertical content 1</tab>
<tab heading="Vertical 2">Vertical content 2</tab>
</tabset>
Expand Down
2 changes: 0 additions & 2 deletions src/tabs/docs/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ var TabsDemoCtrl = function ($scope) {
alert('You\'ve selected the alert tab!');
});
};

$scope.navType = 'pills';
};
5 changes: 3 additions & 2 deletions src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ angular.module('ui.bootstrap.tabs', [])
restrict: 'EA',
transclude: true,
replace: true,
scope: {},
scope: {
type: '@'
},
controller: 'TabsetController',
templateUrl: 'template/tabs/tabset.html',
link: function(scope, element, attrs) {
scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false;
scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false;
scope.type = angular.isDefined(attrs.type) ? scope.$parent.$eval(attrs.type) : 'tabs';
}
};
})
Expand Down
4 changes: 2 additions & 2 deletions src/tabs/test/tabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ describe('tabs', function() {
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope;
//instantiate the controller stand-alone, without the directive
ctrl = $controller('TabsetController', {$scope: scope, $element: null});
ctrl = $controller('TabsetController', {$scope: scope});
}));


Expand Down Expand Up @@ -609,7 +609,7 @@ describe('tabs', function() {
scope = $rootScope.$new();
scope.navType = 'pills';

elm = $compile('<tabset type="navType"></tabset>')(scope);
elm = $compile('<tabset type="{{navType}}"></tabset>')(scope);
scope.$apply();
}));

Expand Down
2 changes: 1 addition & 1 deletion template/tabs/tabset.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

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