I\'m just starting to play around with AngularJS and trying to understand the binding technique. For starters, I tried to make a simple conversion calculator (dozens to pieces,
The problem here is that the input type="range" works with Strings and not with Numbers (while input type="number" only works with Numbers).
http://www.w3.org/wiki/HTML/Elements/input/range
The range state represents a control for setting the element's value to a string representing a number.
If you add val = parseInt(val)
as your first instruction on the qty
setter it should work:
this.__defineSetter__("qty", function (val) {
val = parseInt(val);
qty = val;
dozens = val / 12;
});
jsfiddle: http://jsfiddle.net/bmleite/2Pk3M/2/