I need to implement a function in my component.ts file that will toggle the accordion using a button. Can you help me with the script for this?
This is my HTML code:
<button (click)="toggleAcc()" type="button" class="btn btn-primary">Primary</button>
<ngb-accordion id="acc1" #acc="ngbAccordion" activeIds="ngb-panel-0">
<ngb-panel id="detailAcc">
<ng-template ngbPanelTitle>
<span>★ <b>Fancy</b> title ★</span>
</ng-template>
<ng-template ngbPanelContent>
Hello World!!!!
</ng-template>
</ngb-panel>
</ngb-accordion>
I am looking for a script for the toggleAcc method
@Component({
selector: 'my-component',
templateUrl: './my-component.html'
})
toggleAcc(){
**********Need code here to toggle the accordion*********
}
I am using Angular 14, Bootstrap 5, and ng-bootstrap12