I am trying to add css in Angular component, but it is not working. I am using tabmodule
of ngx-bootstrap
Tabs.
Here is my code:
.component.html
<tabset class="tab-container">
<tab *ngFor="let tab of tabs" active="tab.active" appTabHighlight>
<ng-template tabHeading><span>{{tab.title}}</span> <i class="fas fa-times" (click)="removeTab($event, $index)"></i></ng-template>
<h1>{{tab.content}}</h1>
</tab>
<button class="btn btn-default" (click)="addTab()"></button>
</tabset>
In the dom something like the following gets created:
<tabset _ngcontent-c17="" class="tab-container">
<ul class="nav nav-tabs" ng-reflect-klass="nav" ng-reflect-ng-class="[object Object]">
<li class="nav-item ng-star-inserted" ng-reflect-ng-class="nav-item,">
<a class="nav-link" href="javascript:void(0);" id="">
<span ng-reflect-ng-transclude="[object Object]"></span>
<span _ngcontent-c17="" class="ng-star-inserted">Tab 1</span>
<i _ngcontent-c17="" class="fas fa-times ng-star-inserted"></i><!--bindings={}-->
</a>
</li>
</ul>
Now when I try to add css, as follows nothing seems to work. border-bottom doesn't get applied.:
.tab-container {
ul {
&.nav-tabs {
border-bottom: 4px solid red;
}
}
}
Update
Setting encapsulation to ViewEncapsulation.None
worked for me, but it would cause some other issues for my component. If someone could figure out a reason for this not working, that would be great.