You can use first
variable, I made an stackblitz, you can see here.
You can do as this way:
<mat-accordion class="example-headers-align">
<mat-expansion-panel *ngFor="let item of [1,2,3]; first as isFirst" [expanded]="isFirst">
<mat-expansion-panel-header>
<mat-panel-title> {{item}} </mat-panel-title>
</mat-expansion-panel-header>
{{item}}
</mat-expansion-panel>
</mat-accordion>
You can see here the use of the *ngFor
variables for more information.