app.component.ts
import { Component } from '@angular/core';
import { NgbPanelChangeEvent } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public beforeChange($event: NgbPanelChangeEvent) {
if ($event.panelId === 'first-panel') {
$event.preventDefault();
}
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - How to prevent toggle Accordion panel
</h4>
<ngb-accordion #acc="ngbAccordion" (panelChange)="beforeChange($event)">
<ngb-panel title="First Panel [Can't Toggle]" id="first-panel">
<ng-template ngbPanelContent>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In egestas felis eget nisi porttitor, et faucibus est interdum.
</ng-template>
</ngb-panel>
<ngb-panel title="Second Panel" id="second-panel">
<ng-template ngbPanelContent>
Vivamus nec enim vel metus sodales hendrerit.
Curabitur imperdiet condimentum eleifend.
Integer diam tortor, dapibus eget nisi vel, vestibulum varius quam.
</ng-template>
</ngb-panel>
<ngb-panel title="Third Panel" id="third-panel">
<ng-template ngbPanelContent>
Proin ultrices urna fermentum quam porttitor interdum.
Phasellus id erat elit. Morbi et bibendum est.
Mauris nec fermentum eros, id facilisis orci.
Donec luctus consectetur tortor sed malesuada.
</ng-template>
</ngb-panel>
</ngb-accordion>
- angular bootstrap - How to collapse Accordion all panels
- angular bootstrap - Accordion panel custom header
- angular bootstrap - Disable collapse close Accordion panel
- angular bootstrap - How to use Nav
- angular material - Slider step, minimum & maximum value
- angular material - How to invert Slider
- angular material - How to change Slide toggle label position
- angular material - How to use custom Badge size
- angular material - Badge position before & below after
- angular material - Open Accordion multiple panels at once
- angular material - Show Accordion toggle icon on left
- angular material - Open & close Expansion Panel on button click
- angular material - How to initially expand Expansion Panel
- angular material - Accordion expanded panels header background color
- angular material - How to use Action List