I have a mat-accordion element with multiple expansion panels that are generated dynamically. How can I programmatically select and expand the last mat-expansion-panel element?
<mat-accordion>
<mat-expansion-panel>
text 0
</mat-expansion-panel>
<mat-expansion-panel>
text 1
</mat-expansion-panel>
<mat-expansion-panel>
text 2
</mat-expansion-panel>
...
</mat-accordion>
<button (click)="addNewItemAndExpandIt()">Add item and expand it</button>