This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 I've got an HTML heading, and a select callback. Pretty cool!
1919 </ tab >
2020 </ tabset >
21+
22+ < hr />
23+
24+ < tabset vertical ="true ">
25+ < tab heading ="Vertical 1 "> Vertical content 1</ tab >
26+ < tab heading ="Vertical 2 "> Vertical content 2</ tab >
27+ </ tabset >
2128</ div >
Original file line number Diff line number Diff line change 11AngularJS version of the tabs directive.
22
3- Allows a ` select ` callback attribute, ` active ` binding attribute and ` disabled ` binding attribute.
3+ ### Settings ###
44
5- Allows either ` heading ` text-heading as an attribute, or a ` <tab-heading> ` element inside as the heading.
5+ #### ` <tabset> ` ####
6+
7+ * ` vertical `
8+ _ (Defaults: false)_ :
9+ Whether tabs appear vertically stacked.
10+
11+ #### ` <tab> ` ####
12+
13+ * ` heading ` or ` <tab-heading> `
14+ :
15+ Heading text or HTML markup.
16+
17+ * ` active ` <i class =" icon-eye-open " ></i >
18+ _ (Defaults: false)_ :
19+ Whether tab is currently selected.
20+
21+ * ` disabled ` <i class =" icon-eye-open " ></i >
22+ _ (Defaults: false)_ :
23+ Whether tab is clickable and can be activated.
24+
25+ * ` select() `
26+ _ (Defaults: null)_ :
27+ An optional expression called when tab is activated.
Original file line number Diff line number Diff line change @@ -43,7 +43,10 @@ function TabsetCtrl($scope, $element) {
4343 transclude : true ,
4444 scope : { } ,
4545 controller : 'TabsetController' ,
46- templateUrl : 'template/tabs/tabset.html'
46+ templateUrl : 'template/tabs/tabset.html' ,
47+ link : function ( scope , element , attrs ) {
48+ scope . vertical = angular . isDefined ( attrs . vertical ) ? scope . $eval ( attrs . vertical ) : false ;
49+ }
4750 } ;
4851} )
4952
Original file line number Diff line number Diff line change @@ -404,13 +404,6 @@ describe('tabs', function() {
404404 scope . $apply ( ) ;
405405 } ) ) ;
406406
407- function titles ( ) {
408- return elm . find ( 'ul.nav-tabs li' ) ;
409- }
410- function contents ( ) {
411- return elm . find ( 'div.tab-content div.tab-pane' ) ;
412- }
413-
414407 function expectTabActive ( activeTab ) {
415408 var _titles = titles ( ) ;
416409 angular . forEach ( scope . tabs , function ( tab , i ) {
@@ -454,4 +447,17 @@ describe('tabs', function() {
454447 } ) ;
455448 } ) ;
456449
450+ describe ( 'vertical' , function ( ) {
451+ beforeEach ( inject ( function ( $compile , $rootScope ) {
452+ scope = $rootScope . $new ( ) ;
453+
454+ elm = $compile ( '<tabset vertical="true"></tabset>' ) ( scope ) ;
455+ scope . $apply ( ) ;
456+ } ) ) ;
457+
458+ it ( 'to stack tabs' , function ( ) {
459+ expect ( elm . find ( 'ul.nav-tabs' ) ) . toHaveClass ( 'nav-stacked' ) ;
460+ } ) ;
461+ } ) ;
462+
457463} ) ;
Original file line number Diff line number Diff line change 11
22< div class ="tabbable ">
3- < ul class ="nav nav-tabs " ng-transclude >
3+ < ul class ="nav nav-tabs " ng-class =" {'nav-stacked': vertical} " ng- transclude>
44 </ ul >
55 < div class ="tab-content ">
66 < div class ="tab-pane "
You can’t perform that action at this time.
0 commit comments