Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

319
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda