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

327
Visualizações
NGX-Slider min and max value set with dynamic value

I'm trying to set my slider-thumb of the Ngx-slider based on a dynamic value, retrieved from an API call.

First I make an init of the variables.

minAgeValue: number = 0;
maxAgeValue: number = 0;

Second I set the min and max value based on a GET request:

const getfilterage = environment.apiUrl + '/GetAgesForFilter';
this.http.get<any>(getfilterage).subscribe({
  next: (response) => {
    this.minAgeValue = Math.min.apply(null, response.data);
    this.maxAgeValue = Math.max.apply(null, response.data);
  },
});

And this is how i fill the fields in HTML with the variables:

<input type="number" id="min-Age" class="yearField" [(ngModel)]="minAgeValue" />
<label> t/m </label>
<input type="number" id="max-Age" class="yearField" [(ngModel)]="maxAgeValue" />
<div class="custom-ngx-slider">
  <ngx-slider
    id="ngx-slider-custom"
    [(value)]="minAgeValue"
    [(highValue)]="maxAgeValue"
    [options]="optionsAge"
  ></ngx-slider>
</div>

My problem is that sometimes the slider thumb is set correctly with the expected values. And sometimes (most of the times) the slider thumb is set to the floor value. Check here for an example of what I mean enter image description here

about 4 years ago · Juan Pablo Isaza
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