I need to access all components in stepper's step in typescript, i have the following:
<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>
Knowing that comp1
and comp2
implements IComp
(custom interface)
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
}
}
the main component has
ChangeSelection(event) {
var m = (<IComp>event.selectedStep);
if (m.MethodeFromInterface.InnerComponents[0]) // InnerComponents is an example
m.MethodeFromInterface("TEST");
}
so is there is anything like innerComponents inside MatStep ?