ngx-slider: Set formControl value manually doesn't update the view

I’ve problems to set values manually in formControl. On ngOnInit, I call this code to test:

sliderControl: FormControl = new FormControl(360);

this.sliderControl.setValue(60)

On my view HTML, the value 60min appears and it’s ok. But the slider position, is on initial position, as you can see:

image

The position didn’t change. The expected behavior is: image.

My options:

 options: Options = {
    step: 30,
    floor: 0,
    ceil: 1439,
    showSelectionBar: true,

    getSelectionBarColor: (value: number): string => {
        if (value <= 150) {
            return 'green';
        }
        if (value <= 360) {
            return 'yellow';        }

        if (value <= 900) {
          return 'orange';
      }        
        if (value <= 1440) {
            return 'red';
        }
        return '#2AE02A';
    },

I’m using this version of ng5-slider: Version “ng5-slider”: “^1.1.14”,

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17 (2 by maintainers)

Most upvoted comments

In recent changes, I re-wrote most of value update and normalisation code using rxjs, fixing a lot of similar bugs.

This should be fixed once I make the next release in the next day or two.