A scrollable tab plugin compatible with angular-ui bootstrap tabs.
- Bootstrap CSS
- jQuery
- AngularJS
- angular-ui-bootstrap
- Include
angular-ui-tab-scroll.jsandangular-ui-tab-scroll.cssin your page. - Add
ui.tab.scrollto your angular module dependencies. - Wrap your
<tabset>inside of<scrollable-tabset>, like so:
<scrollable-tabset show-tooltips="true">
<tabset>
<tab ng-repeat="x in tabs">...</tab>
</tabset>
</scrollable-tabset>show-tooltips- whether or not to show the side-tooltipstooltip-left- which tooltip direction to use for the left tooltip (bottom, top, left, right) - defaults to bottomtooltip-right- which tooltip direction to use for the right tooltip (bottom, top, left, right) - defaults to bottomtooltip-text-selector- the selector for your tooltips, defaults to*:not(:has("*:not(span)"))scroll-left-icon- the CSS class(es) to customize the left navigation button icon, defaults toglyphicon glyphicon-chevron-leftscroll-right-icon- the CSS class(es) to customize the right navigation button icon, defaults toglyphicon glyphicon-chevron-right
These options can directly be set on each directive as DOM attributes.
Example:
<scrollable-tabset show-tooltips="true"
tooltip-left="right"
tooltip-right="left"
scroll-left-icon="glyphicon glyphicon-chevron-left"
scroll-right-icon="glyphicon glyphicon-chevron-right">
<tabset>
<tab ng-repeat="x in tabs">...</tab>
</tabset>
</scrollable-tabset>
Or, they can be configured globally for all your scrollable-tabset directives, by using the scrollableTabsetConfigProvider, in the config section of your app.
Example:
angular.module('yourApp', [])
.config(['scrollableTabsetConfigProvider', function(scrollableTabsetConfigProvider){
scrollableTabsetConfigProvider.setShowTooltips(false);
scrollableTabsetConfigProvider.setScrollLeftIcon('glyphicon glyphicon-chevron-left');
scrollableTabsetConfigProvider.setScrollRightIcon('glyphicon glyphicon-chevron-right');
//...set other properties here
}]);
Here is a working plunker : http://plnkr.co/edit/BheQyO7W9qXS0F6vZTlg?p=preview
This way, you can keep the directive usage simple in all your html templates!
Important Note: When an option is both defined at directive level and at config level, the value specified in the DOM takes precedence over the one from the config!.