我有一个交叉引用数组:
examples = [{name: "ex1",steps: 'ex1Steps'},
{name: "ex2",steps:'ex2Steps'},
{name: "ex3",steps:'ex3Steps'}];
和 3 个数组
ex1Steps
...
ex3Steps=[{name...},{...}]
我想使用示例数组中的 ngfor 循环访问这些最后的数组值。我尝试了一些类似的东西:
<mat-list>
<div>Examples :</div>
<ng-container *ngFor="let example of examples;let i=index;" (click)="selectedExample = {examples[i].steps}">
<mat-list-item>{{example.name}}</mat-list-item>
</ng-container>
</mat-list>
和:
<mat-vertical-stepper>
<mat-step *ngFor="let step of example.steps" [label]="step.name">