app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
message: string = "";
onExpand(){
this.message = "Expansion animation happened.";
}
onCollapse(){
this.message = "Collapse animation happened.";
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to use
Expansion Panel afterCollapse and afterExpand event
</h2>
<h3>Event : {{message}}</h3>
<!--
afterExpand event emitted after expansion animation happens.
afterCollapse event emitted after collapse animation happens.
-->
<mat-expansion-panel
(afterCollapse)="onCollapse()"
(afterExpand)="onExpand()">
<mat-expansion-panel-header>
<mat-panel-title>AutoML</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 size
- 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 - How to initially expand Expansion Panel
- angular material - Initially expand a panel in Accordion
- angular material - Expansion Panel expandedChange event
- angular material - How to change Expansion Panel header height