How can I replace or add a new class on UI-Bootsrap's Tab Nav. I'm expecting something like,
<ul class="MY-CUSTOM-CLASS" ng-class="{'nav-stacked': vertical, 'nav-justified': justified}" ng-transclude="">
<li ng-class="{active: active, disabled: disabled}" heading="Justified" class="ng-isolate-scope">
<a href="" ng-click="select()" tab-heading-transclude="" class="ng-binding">Justified</a>
</li>
.....
</ul>
I've tried the following but, it's adding the class to the parent,
<tabset justified="true" class="tab-nav">
<tab heading="Justified">Justified content</tab>
<tab heading="SJ">Short Labeled Justified content</tab>
<tab heading="Long Justified">Long Labeled Justified content</tab>
</tabset>
Ok, what you wan't to do is not supported by the ui bootstrap module, so we need to extend the module to get the requested behavior. To do that we will use decorators:
This takes the old
link
method of the tabset directive and wraps it with an custom method that in addition to the old method also binds the value of thecustom-class
attribute to the scope. Second thing we need to do is overriding the template to actually use thescope.customClass
parameter:There are multiple ways to this either use the
$templateProvider
or maybe simpler way use a<scrip type="text/ng-template">
:Plunker: http://plnkr.co/edit/M3MgEPY6rfGuUda2a2N7?p=preview