Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Creating an angular material slider range with custom steps

I want to create a mat-slider with custom steps of 0.25, 0.5, 1, 2, 3

What value can I give my increment? code below

<mat-slider #slider  [min]="0.25" [max]="3" [step]="[increment]" (input)="onInputChange($event)" </mat-slider>

this.increment = ???
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

step's type is number so I afraid you can't reach your goal directly.

But an indirect solution can be like this: we want to have a mat-slider that it's output( finalValue:number ) can be 0.25 or 0.5 or ... .

1- You have 5 steps. Store the steps in a array like steps=[0.25 , 0.5 , 1 , 2 , 3]

2- Use mat-slide as usual in order to have 5 steps. for example set min=0, max=4, step=1

3- In onInputChange() you can see the new value of mat-slide. Let's name it stepIndex,which is an integer between 0 and 4.

4- Use the stepIndex to figure out the final value. A simple mapping.

You can see all of this in here:

https://stackblitz.com/edit/angular-p2iz4u?file=src%2Fapp%2Fslider-overview-example.ts

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!