app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: [`
mat-slider{
width: 400px;
}
`]
})
export class AppComponent {
value:number = 1;
formatLabel(value: number) {
return String.fromCharCode(value);
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - Show custom thumb label in Slider
</h2>
<h3>Selected Value : {{value}}</h3>
<h3>String From Char Code : {{formatLabel(value)}}</h3>
<mat-slider
[(ngModel)]="value"
thumbLabel="true"
min="1"
max="120"
[displayWith]="formatLabel">
</mat-slider>
app.module.ts [import]
import { MatSliderModule } from '@angular/material/slider';
import { FormsModule } from '@angular/forms';
- angular material - Tick interval with step in Slider
- angular material - How to invert Slider
- angular material - How to show thumb label in Slider
- angular material - How to use Slider change event
- 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 change Badge size
- angular material - How to use custom Badge size
- angular material - How to show custom color in Badge
- 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 - How to disable a panel in Accordion
- angular material - How to hide Accordion panels toggle icon