Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using slider multiplies number #47

Closed
ElanHasson opened this issue Dec 29, 2014 · 16 comments
Closed

Using slider multiplies number #47

ElanHasson opened this issue Dec 29, 2014 · 16 comments

Comments

@ElanHasson
Copy link

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
Copy link
Owner

darul75 commented Dec 29, 2014

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
Copy link
Author

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

@ElanHasson
Copy link
Author

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

@darul75
Copy link
Owner

darul75 commented Dec 29, 2014

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

@ElanHasson
Copy link
Author

@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
Copy link
Owner

darul75 commented Dec 30, 2014

Ok nice I check asap and keep you informed

darul75 added a commit that referenced this issue Dec 31, 2014
darul75 added a commit that referenced this issue Dec 31, 2014
darul75 added a commit that referenced this issue Dec 31, 2014
@darul75
Copy link
Owner

darul75 commented Dec 31, 2014

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

@darul75
Copy link
Owner

darul75 commented Dec 31, 2014

@ElanHasson
Copy link
Author

So you were able to reproduce and resolve?

@darul75
Copy link
Owner

darul75 commented Dec 31, 2014

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
Copy link
Owner

darul75 commented Jan 1, 2015

Confirme me if you still have issue, thx

@ElanHasson
Copy link
Author

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" [email protected] wrote:

Confirme me if you still have issue, thx


Reply to this email directly or view it on GitHub
#47 (comment).

@darul75 darul75 reopened this Jan 3, 2015
@darul75
Copy link
Owner

darul75 commented Jan 3, 2015

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
Copy link
Author

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

parseInt() fixed it.

@darul75
Copy link
Owner

darul75 commented Jan 8, 2015

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

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

@ElanHasson
Copy link
Author

perhaps be safe and wrap $scope.defaultAmount in parseInt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants