tb / ng2-nouislider

Angular2 noUiSlider directive
http://tb.github.io/ng2-nouislider/
MIT License
185 stars 114 forks source link

Error when setting start with the value of a variable. #221

Closed Beta6484 closed 4 years ago

Beta6484 commented 4 years ago

Hello! I'm working with Angular v8, noUiSlider v14.2.1 and ng2-noUiSlider v1.8.2.

I need the initial value of my slider to come from a variable whose value was calculated in a previous step. I set this variable to "start". The method assigned to the slide action takes the value of this variable, which is being displayed at one point on the page and assigns a new value. The error that returns after displaying a first value is:

core.js:6014 ERROR TypeError: Cannot read property 'from' of undefined at NouisliderComponent.toValues (ng2-nouislider.js:182) at Object.<anonymous> (ng2-nouislider.js:145) at nouislider.js:1978 at Array.forEach (<anonymous>) at nouislider.js:1977 at Array.forEach (<anonymous>) at fireEvent (nouislider.js:1973) at nouislider.js:2109 at Array.forEach (<anonymous>) at moveHandles (nouislider.js:2108) defaultErrorLogger @ core.js:6014 handleError @ core.js:6066 next @ core.js:40558 schedulerFn @ core.js:35336 __tryOrUnsub @ Subscriber.js:185 next @ Subscriber.js:124 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:35298 (anonymous) @ core.js:39738 invoke @ zone-evergreen.js:359 run @ zone-evergreen.js:124 runOutsideAngular @ core.js:39572 onHandleError @ core.js:39735 handleError @ zone-evergreen.js:363 runTask @ zone-evergreen.js:171 invokeTask @ zone-evergreen.js:465 invokeTask @ zone-evergreen.js:1603 globalZoneAwareCallback @ zone-evergreen.js:1629

If I set "start" to any number, the error does not occur. Thank you in advance for your attention.

Beta6484 commented 4 years ago

Sorry, the solution was to separate the variable.