@ViewChild
will grab a directive ref from the template. Using a class will only get the first. Getting others requires knowing the id upfront.
I have one main accordion with 3-4 items. Within two of those, there is another accordion with a user-determined number of items. Each of those items can have another nested accordion, and each of those another. There could be hundreds of accordions based on user input (realistically: ~20).
I am attempting to create a nav bar for these accordions. The user will click and the correct accordion item (and all its parent accordions) will open to show the selected item.
I have the generated ids for an accordion/item and its parents, how do I get the ngbAccordion/Item for it, like I would with @ViewChild
?
All of the DOM accessors only return HTMLElement
s, which are not directives and cannot be cast to them.
Am I stuck with using the ids to find their -toggle
s to use .click()
on? I would much prefer to take advantage of accordion's .expand()
.