leongersen / noUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
https://refreshless.com/nouislider/
MIT License
5.64k stars 658 forks source link

Cannot read properties of undefined (reading 'destroy') #1249

Closed sumegha26 closed 1 year ago

sumegha26 commented 1 year ago

I have the latest version and getting this error:

Cannot read properties of undefined (reading 'destroy')-> this.slider.destroy()

Can you please check this ?

"nouislider": "^15.7.0",

"ng2-nouislider": "^2.0.0",

leongersen commented 1 year ago

There is not enough information here for me to do anything.

sumegha26 commented 1 year ago

Hi, @leongersen

This is issue in ng2-nouislider -

https://github.com/tb/ng2-nouislider/blob/0c186b31007ff724578165b5984dfb75f96a90ba/projects/ng2-nouislider/src/lib/ng2-nouislider.component.ts#L117

Error - when slider is not defined - Cannot read properties of undefined (reading 'destroy')-> this.slider.destroy()

Fix -

Add check if slider is defined

if (this.slider) {
 this.slider.destroy();
}

or this.slider?.destroy();

sumegha26 commented 12 months ago

@leongersen any update on this ??