app.component.ts
import { Component } from '@angular/core';
import { MatExpansionPanel } from '@angular/material/expansion';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
message: string = "";
onExpandedChange(panel:MatExpansionPanel){
this.message = "Expansion Panel "
+ (panel.expanded? 'Expanded' : 'Collapsed');
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to use
Expansion Panel expandedChange event
</h2>
<h3>Event: {{message}}</h3>
<mat-expansion-panel
#panel
(expandedChange)="onExpandedChange(panel)">
<mat-expansion-panel-header>
<mat-panel-title>Bash</mat-panel-title>
</mat-expansion-panel-header>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Integer vitae semper massa. Donec maximus, dui nec
dignissim blandit, ante odio varius ex,
nec volutpat erat justo ac magna.
</mat-expansion-panel>
app.module.ts [import]
import {MatExpansionModule} from '@angular/material/expansion'
- angular material - How to change Slide toggle checked color
- angular material - How to use Badge with text
- angular material - How to change Badge position
- angular material - How to toggle Badge visibility
- angular material - How to use Accordion
- angular material - How to use Expansion Panel
- angular material - Action bar inside an Expansion Panel
- angular material - Expansion Panel opened & closed event
- angular material - How to use Accordion flat display mode
- angular material - Open & close Expansion Panel on button click
- angular material - Expansion Panel afterExpand & afterCollapse event
- angular material - How to initially expand Expansion Panel
- angular material - Initially expand a panel in Accordion
- angular material - How to change Expansion Panel header height
- angular material - How to use Selection List