ngbAccordion doesnt open panels from activeIds array when coming from another page with router
See original GitHub issuehey, mates, pls can u help me in understanding why i cant display activeIds on ngbaccordion on another page while i using router(i have accordion with title name of projects, im going from accordion with click on title project, on main page, to another on another page) ? i try to catch em on OnInit, AfterView** hooks with “this.acc.activeIds = this.arr.map((el, i) => ngb-panel-${i}
);” but nothing happens. It works(panels are open) only when i reload page, although acc.activeIds already have had array with panels to open. I think im doing smth wrong or doesnt understand how to do with it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
ngbAccordion doesnt open panels from activeIds array when ...
I think I'm doing something wrong or doesn't understand how to do with it. Anyway with click on project and go to second-page...
Read more >Sep 2017 - angular/angular - Gitter
I tried (helpAcc)="ngbAccordion" but that doesn't seem to work. ... because my panel IDs are numeric and css id can not start with...
Read more >[Solved]-router navigate doesn't redirect to other page-angular.js
Coding example for the question router navigate doesn't redirect to other ... ngbAccordion doesnt open panels from activeIds array when coming from another...
Read more >Accordion - Angular powered Bootstrap
Accordion is a collection of collapsible panels (bootstrap cards). ... Selector: 'ngb-accordion' ... Opening a new panel will close others. Type: boolean.
Read more >angular 6 dynamic accordion example
Open the first attached expansion panel in an Angular Material. For drawing the chart First, ... I think activeIds can't see the change...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From future: this is a gotcha which we stumbled upon recently. The first time a ngbAccordion is loaded, it assigns the ids
ngb-panel-0
,ngb-panel-1
…ngb-panel-{{n}}
to the panels by default (if they don’t have ids assigned manually); but when you take a detour to another page and come back again, these panels will have idsngb-panel-{{n+1}}
…ngb-panel-{{2n + 1}}
, so you can’t manipulate the panels with the old ids any more. The solution is to manually specify ids for the panels.Since the documentation also exploits the default ids in the examples, I think this pitfall deserves a line in the documentation.
@benouat thx, also have done, stackblitz goes to reload page when i come back to previous path, but any way with click on project and go to second-page route mine acc.activeIds dont have open state. How i can fix this? any hook cant help me or provide directive to html as [activeIds], i tried( https://stackblitz.com/edit/angular-7g3yp5?file=src%2Fapp%2Facc-list%2Facc-list.component.ts