角材料选项卡未突出显示

时间:2018-07-06 08:01:12

标签: html angular typescript angular-material

由于[(selectedIndex)]="",我正在尝试以编程方式设置选定的索引,但它工作正常,但是每当选择索引时,所选项目就不会突出显示。

之所以选择它,是因为您可以看到它的内容,但是没有图形显示选定的选项卡状态。 这是错误还是可以通过某种方式完成?

HTML

 <mat-tab-group [(selectedIndex)]="this.dataService.selectedTabs[0]">
  <mat-tab *ngFor="let Tab of this.dataService.Tabs">
    <ng-template mat-tab-label>
      {{Tab.label}}
    </ng-template>
    <div *ngIf="Tab.childTabs.length !== 0">
     //INSIDE OF THIS SECTION THERE ARE MORE NESTED TABS
    </div>
  </mat-tab>
</mat-tab-group>

当我打开此选项卡时,其内容内的嵌套选项卡不会突出显示,而是会打开。

Ts

public selectedTabs: any[] = [
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
];

1 个答案:

答案 0 :(得分:1)

此解决方案有效,但主要是一种解决方法。 只需将此代码添加到 style.css 文件中:

.mat-tab-label-active {
bottom-border-style:solid !important;
opacity: 1 !important;
}