我正在使用角度 7 中的 CDKStepper 创建自定义步进器,
我在用
<cdk-step>
<ng-template cdkStepLabel>Fill out your name 1</ng-template>
<p>This is any content of "Step 1"</p>
</cdk-step>
并在步进模板中 - 用于导航,我正在使用
<ul class="nav nav-pills wizard-navigation-ul">
<li class="step" *ngFor="let step of steps; let i = index;" [ngClass]="{'active': selectedIndex === i}">
<a href="javascript:void()" (click)="onClick(i, step)" data-toggle="tab">{{step.stepLabel}}</a>
</li>
</ul>
并在 Component.ts
onClick(index: number, step: any): void {
console.log(step); // here i want to console the title of the step clicked, in this case TEXT of this "<ng-template cdkStepLabel>Fill out your name 1</ng-template>"
this.selectedIndex = index;
}
如何获取存储在中的标题<ng-template cdkStepLabel>Fill out your name 1</ng-template>
?