【问题标题】:i need to add matTooltip in mat-tab without icon angular 8 and angular material is used我需要在没有图标 angular 8 的 mat-tab 中添加 matTooltip,并且使用了角度材料
【发布时间】:2020-02-23 11:48:41
【问题描述】:

有没有什么方法可以在 mat-tab 中添加没有图标的 tooltip

我正在尝试在有角度的材料 mat-tab 中实现工具提示,但如果没有 mat-icon,工具提示将无法工作

下面是代码:

<mat-tab label="Application Request" matTooltip="Info about the action" >

【问题讨论】:

  • &lt;mat-tab label="Application Request" matTooltip="Info about the action" &gt;

标签: angular


【解决方案1】:

我发现答案工具提示将显示在 span 代码中是

                                    <span class="sg-mat-txt" matTooltip="Application Request" aria-label="">Application Request</span>
                                  </ng-template>```

【讨论】:

    【解决方案2】:

    引用材料文档

    对于更复杂的标签,添加带有 mat-tab-label 的模板 mat-tab 中的指令。

    <mat-tab-group>
      <mat-tab>
        <ng-template mat-tab-label>
          The <em>best</em> pasta
        </ng-template>
        <h1>Best pasta restaurants</h1>
        <p>...</p>
      </mat-tab>
      <mat-tab>
        <ng-template mat-tab-label>
          <mat-icon>thumb_down</mat-icon> The worst sushi
        </ng-template>
        <h1>Terrible sushi restaurants</h1>
        <p>...</p>
      </mat-tab>
    </mat-tab-group>
    

    如果你想让标签更复杂,基本上同样的事情也适用于工具提示和任何其他材料组件。

    【讨论】:

    • 我在我的问题中提到在 mat-tab 中添加没有图标的工具提示
    • 好的,你能解释一下你的意思吗?你想使用 mat-icon 和 mat-tab 吗?您所说的“不工作”到底是什么意思?
    • 我需要在您的答案中在 mat-tab 上应用不带 mat-icon 的工具提示 tootlip is not applied
    猜你喜欢
    • 1970-01-01
    • 2017-06-15
    • 2020-09-28
    • 2021-09-10
    • 2020-12-19
    • 2015-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多