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

326
Views
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
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!