app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: [`
.iconStyle{
margin-right:8px;
}
`]
})
export class AppComponent {
message:string = "";
onDelete(){
this.message = "Delete action list item clicked.";
}
onRestore(){
this.message = "Restore action list item clicked.";
}
onDownload(){
this.message = "Download action list item clicked.";
}
onUpload(){
this.message = "Upload action list item clicked.";
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:16px;">
Angular Material - Action list with button and icon
</h2>
<h3>{{message}}</h3>
<mat-action-list>
<button mat-list-item (click)="onDelete()">
<mat-icon class="iconStyle">delete</mat-icon>
Delete
</button>
<button mat-list-item (click)="onRestore()">
<mat-icon class="iconStyle">restore</mat-icon>
Restore
</button>
<button mat-list-item (click)="onDownload()">
<mat-icon class="iconStyle">download</mat-icon>
Download
</button>
<button mat-list-item (click)="onUpload()">
<mat-icon class="iconStyle">upload</mat-icon>
Upload
</button>
</mat-action-list>
app.module.ts [import]
import { MatListModule } from '@angular/material/list'
import { MatButtonModule } from '@angular/material/button'
import { MatIconModule } from '@angular/material/icon';
- angular material - How to use Slider
- angular material - Tick interval with step in Slider
- angular material - How to use Slider input event
- angular material - How to change Slide toggle checked color
- angular material - How to change Badge position
- angular material - How to use Accordion
- angular material - Action bar inside an Expansion Panel
- angular material - How to use Accordion flat display mode
- angular material - Expansion Panel afterExpand & afterCollapse event
- angular material - Expansion Panel header expanded background color
- angular material - How to use List dense layout mode
- angular material - How to use Navigation List
- angular material - Navigation list with button and icon
- angular material - How to use Action List
- angular material - How to use Selection List