我需要在打字稿中访问步进器步骤中的所有组件,我有以下内容:
<mat-vertical-stepper #stepper (selectionChange)="ChangeSelection($event)">
<mat-step label="Step 1">
Step 1
</mat-step>
<mat-step label="Step 2">
Step 2
<app-comp1> </app-comp1>
<app-comp2> </app-comp1>
</mat-step>
</mat-vertical-stepper>
知道comp1
并comp2
实现IComp
(自定义界面)
export interface IComp {
MethodeFromInterface?: { (data?: any): void }; //this is optional
}
export class Comp1 implements IComp {
MethodeFromInterface(data: any) {
//do something here
}
}
export class Comp2 implements IComp {
MethodeFromInterface(data: any) {
//do something here
}
}
主要成分有
ChangeSelection(event) {
var m = (<IComp>event.selectedStep);
if (m.MethodeFromInterface.InnerComponents[0]) // InnerComponents is an example
m.MethodeFromInterface("TEST");
}
那么 MatStep 内部是否有类似 innerComponents 的东西?