Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
how to open accordion panel on button click in angular

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!