darul75 / angular-awesome-slider

:arrows_clockwise: Angular slider control directive
http://darul75.github.io/angular-awesome-slider/
MIT License
144 stars 63 forks source link

Using slider multiplies number #47

Closed ElanHasson closed 9 years ago

ElanHasson commented 9 years ago

I updated angular to 1.3.8 and now the slider multiplies the value.

For example, I set min to 190,000 and max to 228,000 and any touch to the slider multiplies the current value making the number huge, and outside of the range.

darul75 commented 9 years ago

hi @ElanHasson,

looks like angular team wants to kill me ;)

can you reproduce it with this fiddle by injecting 1.3.8, if I got time I do it too.

http://jsfiddle.net/darul75/g9e9n8xc/

thx

ElanHasson commented 9 years ago

I've added 1.3.8, but still trying to reproduce. http://jsfiddle.net/9fvp275x/

ElanHasson commented 9 years ago

Something is happening to the value between assignment of to and from and ngModel and call to calculate()

darul75 commented 9 years ago

can you send me your calculate method content and options pls I will try reproduce it tomorrow, thx

ElanHasson commented 9 years ago

@darul75 Thanks.. here you go.

$scope.defaultAmount=190000;

            $scope.coverageASliderOptions = {
                from: $scope.defaultAmount,
                to: $scope.defaultAmount+ ($scope.defaultAmount* 0.20),

                step: 500,
                calculate: function(value) {
                    return $filter('currency')(value, '$', 0);
                }

            };
     <input ng-model="data.quote.coverages.coverageA" type="text" id="mySlider1"
                                       slider options="coverageASliderOptions" />
darul75 commented 9 years ago

Ok nice I check asap and keep you informed

darul75 commented 9 years ago

jquery dependency was still there. thx for reporting it, https://github.com/darul75/ng-slider/releases/tag/2.0.9

darul75 commented 9 years ago

http://jsfiddle.net/g9e9n8xc/6/

ElanHasson commented 9 years ago

So you were able to reproduce and resolve?

darul75 commented 9 years ago

Can you check fiddle I have update code, there was a last jquery dependency call when providing function option.. But no I have not reproduced exactly your case.

darul75 commented 9 years ago

Confirme me if you still have issue, thx

ElanHasson commented 9 years ago

I still have the issue. Must be some side effect somewhere.. Odd because that 0.20 is the only multiplication I am performing.

I'll let you know. On Jan 1, 2015 2:22 PM, "Julien Valéry" notifications@github.com wrote:

Confirme me if you still have issue, thx

— Reply to this email directly or view it on GitHub https://github.com/darul75/ng-slider/issues/47#issuecomment-68495365.

darul75 commented 9 years ago

I do not see any problem here, "from" is set to 190000 and "to" to 228000 see third last slider in this fiddle : http://jsfiddle.net/g9e9n8xc/6/ help me reproduce it ;)

ElanHasson commented 9 years ago

Ok-- the issue was actually caused by concatenating my numerics as strings.

parseInt() fixed it.

darul75 commented 9 years ago

good news, do you think I need to change something, was it involved by this affectation :

scope.defaultAmount+ ($scope.defaultAmount* 0.20),

ElanHasson commented 9 years ago

perhaps be safe and wrap $scope.defaultAmount in parseInt