app.component.ts
import { Component } from '@angular/core';
import { MatSlider } from '@angular/material/slider';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: [`
mat-slider{
width: 400px;
}
`]
})
export class AppComponent {
value:number = 0;
message:string = "";
onSliderThumbMove(slider:MatSlider){
this.message = "Slider thumb moved to " + slider.value;
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to use Slider input event
</h2>
<h3>Selected Value : {{value}}</h3>
<h3>{{message}}</h3>
<mat-slider
#slider
[(ngModel)]="value"
(input)="onSliderThumbMove(slider)">
</mat-slider>
app.module.ts [import]
import { MatSliderModule } from '@angular/material/slider';
import { FormsModule } from '@angular/forms';
- angular material - How to align Tabs
- angular material - How to disable Tabs content animation
- angular material - How to generate Tabs programmatically
- angular material - How to create & add Tab programmatically
- angular material - How to use Slider
- angular material - Slider step, minimum & maximum value
- angular material - Tick interval with step in Slider
- angular material - How to invert Slider
- 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 use Slide toggle change event
- angular material - How to use Action List
- angular material - Action list with button and icon
- angular material - How to use Selection List