Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

334
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda