Skip to main content

angular material - Slider step, minimum & maximum value

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})


export class AppComponent { 
  value:number = 1;
}
app.component.html

<h2 style="padding-top:25px; padding-bottom:25px;">
    Angular Material - How to set Slider step,
    minimum and maximum value
</h2>


<h3>Selected Value : {{value}}</h3>

<mat-slider 
    [(ngModel)]="value" 
    min="1" 
    max="10" 
    step="0.5">
</mat-slider>
app.module.ts [import]

import { MatSliderModule } from '@angular/material/slider';
import { FormsModule } from '@angular/forms';
More Angular tutorials