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

Commit

Permalink
fix(tabs): use interpolation for type attribute
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bekos authored and ajoslin committed Jan 21, 2014
1 parent 7727341 commit 83ceb78
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
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

0 comments on commit 83ceb78

Please sign in to comment.