标签所选索引内的垫标签不起作用 [英] mat tab inside tab selected index not working

查看:94
本文介绍了标签所选索引内的垫标签不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当标签内标签,然后如果子选项卡的选择的索引是1,那么它应该作为选择显示.

When tab inside tab then if selected index of sub tab is 1 then it should show as selected.

让父选项卡具有两个选项卡,它的selectedIndex为0,并且父选项卡1中的子选项卡具有selectedIndex = 1,然后其中的内容显示但未显示为选中状态.标签内容已显示,但未选择标签

Let parent tab has two tabs, it has selectedIndex is 0, and sub tab inside parent tab1 has selectedIndex = 1 then content inside it showing but is not showing as selected. Tab content is showing but tab is not selected

这是有效的 示例

Here is the working example

推荐答案

当前存在未解决的问题.解决方法是,可以在父选项卡selectedIndex上使用2种方式绑定,然后仅在选择父选项卡时显示子选项卡组:

There is currently an open issue for this. As a workaround you can use 2 way binding on your parent tab selectedIndex and then only show the subtab group when the parent tab is selected:

<mat-tab-group [(selectedIndex)]="index">
  <mat-tab label="Tab 1">Parent tab 1 Content</mat-tab>
  <mat-tab label="Tab 2">
    <mat-tab-group *ngIf="index == 1" [selectedIndex]="1">
      <mat-tab label="Tab 1">sub tab 1 Content </mat-tab>
      <mat-tab label="Tab 2">sub tab 2 Content
      </mat-tab>
    </mat-tab-group>
  </mat-tab>
</mat-tab-group>

演示

这篇关于标签所选索引内的垫标签不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆