【问题标题】:How to add click on mat label in mat stepper如何在垫子步进器中添加单击垫子标签
【发布时间】:2018-07-09 07:54:35
【问题描述】:

我需要 matSteplabel 上的点击功能。也添加了点击垫步,但没有用!

                  <ng-template (click)="myFunc()" matStepLabel>

                    Snapshot

                  </ng-template>
                  <!-- Start All Backup Data Step1 Data -->

                       <!--app-compare-data-step1></app-compare-data-step1-->

                  <!-- End All Backup Data Step1 Data -->


                </mat-step>
</mat-horizontal-stepper>

【问题讨论】:

  • 您需要添加完整的代码示例,这看起来目前不应该编译。
  • 我添加了,但它被占用了一半代码。如何编辑?
  • 快照 ​​orizo​​ntal-stepper>

标签: angular angular-material stepper


【解决方案1】:

正如Miroslav 提到的,你可以使用这样的东西:

<ng-template matStepLabel>

               <p (click)="myFunc()">Snapshot</P>

</ng-template>

【讨论】:

【解决方案2】:

您使用的ng-template 错误。 ng-template 只是一个包装器,它的内容将被附加到引用它的元素中。

无论您在ng-template 标签上定义的名称接受,都将丢失。 因此,您必须在 ng-template 的正文内而不是标签本身上定义您的 click

【讨论】:

    猜你喜欢
    • 2020-01-16
    • 1970-01-01
    • 2022-12-10
    • 1970-01-01
    • 2020-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-24
    相关资源
    最近更新 更多