I've simplified it for you: http://plnkr.co/edit/rfS9PagKsPQOBXZaZK9U
There are two things that I think you should consider when comparing our code: 1) You were using multiple variables (`$scope.months` and `$scope.value`) for the same purpose. This added needless complexity to your code. 2) You also made a big deal out of restricting the slider to a range of 3 and 12. Given the difficulty I had getting `<input type="number">` to play nicely, I understand wanting to take another route, but using `<input type="number">`'s `min` and `max` attributes is what you should have done, but I bet you tried that and couldn't get it to work. Let me explain why. After reading this ( https://groups.google.com/forum/#!msg/angular/Ecjx2fo8Qvk/x6iNlZrO_mwJ) post, I am betting that the slider's `ng-model-high` directive is changing `$scope.value` from an integer to a string. No matter. I added a simple `$watch` to take care of parsing `$scope.value` back to an integer and all was well in the world. I hope this was helpful! On Wed, Jan 22, 2014 at 4:13 PM, Srikar Shastry <[email protected]>wrote: > Hello, > I'm in a bit of a pickle. > > I have an input box and a slider (i'm using this slider ui: > http://prajwalkman.github.io/angular-slider/ or > https://github.com/prajwalkman/angular-slider). > > The input box should only accept numbers and when it goes below 3, the > value should change back to 3 on ng-blur (not on ng-change, meaning user > can still type 1 and 2. It has to be like this because if I use ng-change, > it restricts me type 1 or 2 hence, I cant type 10 or 20, etc.). Now, the > slider and input box share the same ng-model (two way data binding) making > the user to see what value of slider and vice versa. If a user type a > number in the input box, the slider is adjusted provided the above > condition meets. > > Now, the issue I'm running into an issue, I'm not able to make the input > box value value based on the slider. > > *Here is the example:* > > http://plnkr.co/edit/6nZrECAxxRORuKWmLZ1R?p=preview > > > The condition should still meet keeping the slider restricted between 3 > and 12. How can I achieve that? Any help is appreciated. > > Regards, > Srikar > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
