I have an ng-accordion defined using an *ngFor
loop, and I would like to adjust the location and bind a route to the view of a particular panel. Ideally, when a client clicks to expand a panel, the location would update in the browser and a new history item would be stored in the browser. Additionally, if a client enters a URL which would correspond to a particular accordion item being displayed I want to ensure that the appropriate state is reflected.
For example:
<ngb-accordion closeOthers="true">
<ngb-panel *ngFor="let faq of faqService.getItems()" id="{{faq.id}}" title="{{faq.title}}">
<ng-template ngbPanelContent>
{{faq.body}}
</ng-template>
</ngb-panel>
</ngb-accordion>
And the mapped routes might be:
/faq/ABCD
/faq/EFGH
/faq/IJKL
Toggling a particular panel would update the location/ActiveRoute and pasting a URL which would map to a particular panel would cause that panel to be expanded. Any suggestions on how to wire this up?