I am using custom accordion and I want to open second accordion panel while click on button in first accordion panel.
my code is,
<app-accordion [multi]="true">
<app-expansion-panel id="panel1" [expanded]="true">
<button (click)="continue()">Continue</button>
</app-expansion-panel>
<app-expansion-panel id="panel2">second panel</app-expansion-panel>
</app-accordion>
How to achieve it while click on continue button using angular. pls give any solution
It's better to use a ngFor="let accordion of accordionList; let i = index"
Use a variable in component.ts which keeps track of the expanded accordion panel index(activeIndex), and use [expanded]="i === activeIndex"
And along with (click)="continue()" you need to pass index like this (click)="continue(i)"
And inside continue method, just write logic to update the index of accordion which needs to be expanded based on the current index which it receives. Might be you can use
continue(index) { this.activeIndex = index + 1}