app.component.ts
import { Component } from '@angular/core';
import { MatSlideToggle } from '@angular/material/slide-toggle';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
message:string = "";
onSlideToggleChange(slideToggle:MatSlideToggle){
this.message = "Slide toggle checked change to : "
+ slideToggle.checked
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to use Slide toggle change event
</h2>
<h3>{{message}}</h3>
<mat-slide-toggle
#slideToggle
(change)="onSlideToggleChange(slideToggle)">
Allow location access
</mat-slide-toggle>
app.module.ts [import]
import { MatSlideToggleModule } from '@angular/material/slide-toggle'
- angular material - How to use Slider input event
- angular material - How to use Slide toggle
- angular material - How to get Slide toggle checked status
- angular material - How to change Slide toggle label position
- angular material - How to show Badge in a button
- angular material - How to show Badge with icon
- angular material - Badge position before & below after
- angular material - Icon inside Expansion Panel header
- angular material - Show Accordion toggle icon on left
- angular material - Open & close Accordion all panels at once
- angular material - Determine an Expansion Panel is opened or closed
- angular material - Determine an Expansion Panel is disabled or enabled
- angular material - How to toggle Expansion Panel expanded state
- angular material - Expansion Panel expandedChange event
- angular material - How to change Expansion Panel header height