You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
(This was incorrectly closed and despite requests to reopen, has remained closed so I'm reposting as a new ticket. For future reference, closing old tickets due to lack of activity is probably not a good idea.)
With multiple inputs to the same model doesn't play ball. It works as an input but updating it to a value set from another input always fails. Even if the source is also constrained as numeric (type="range" in chrome). This is due to the model being stored as a string.
Demo: http://jsfiddle.net/TXazw/5/Edit
Edit any input except the number and everything updates except the number input. Edit the number input and everything works fine.
A workaround is included. Uncomment parseFloat line and all inputs work correctly.
Should values not be automatically parsed when applied to a number type input? At the very least type="range" should be outputting a number rather than a string.
Indeed. It sounds petty, and it's probably easy to learn how to write a directive to fix this by passing through parseFloat(), but it's kind of annoying that a binding for input[type=range] is a string instead of a number.
Even if Javascript sometimes uses strings where something else would be suited better, this breaks the principle of least surprise, and has already caused me to create bugs.
Most use cases of input ranges will expect/need a number, and it's not terribly inefficient to support that.
Just traced a weird-looking bug to this - in a language where ("7" + 3) * 10 is 730, having obviously-numeric values be strings is just asking for sensible-looking code to produce insane values.
To summarize:
The bug has been fixed in version 1.5.9. But for it to work you have to add the attribute ng-input-range to the input[type=range] element. This is not necessary for Angular.js 1.6.
Activity
mlegenhausen commentedon Jan 20, 2014
+1
ludoblues commentedon Jan 22, 2014
+1
adamnbowen commentedon Feb 2, 2014
+1
kazekagegaara commentedon Feb 9, 2014
+1
ashclarke commentedon Feb 10, 2014
+1
marcelbuesing commentedon Feb 13, 2014
+1
vchirkov commentedon Feb 20, 2014
+1
lgarron commentedon Mar 6, 2014
Indeed. It sounds petty, and it's probably easy to learn how to write a directive to fix this by passing through
parseFloat(), but it's kind of annoying that a binding forinput[type=range]is a string instead of a number.Even if Javascript sometimes uses strings where something else would be suited better, this breaks the principle of least surprise, and has already caused me to create bugs.
Most use cases of input ranges will expect/need a number, and it's not terribly inefficient to support that.
mismith commentedon Mar 7, 2014
+1
c9s commentedon Mar 9, 2014
+1..
It should have something like ns-type="integer" or ns-type="float"
lcerveau commentedon Mar 20, 2014
+1
mlison commentedon Mar 26, 2014
+1
49 remaining items
westonganger commentedon Jan 1, 2016
+1
FLHerne commentedon Feb 3, 2016
+1.
Just traced a weird-looking bug to this - in a language where ("7" + 3) * 10 is 730, having obviously-numeric values be strings is just asking for sensible-looking code to produce insane values.
tayloj commentedon Feb 17, 2016
+1
ohcrfpv commentedon Apr 20, 2016
+1
dennybiasiolli commentedon Jul 5, 2016
+1
feat(input): add support for input[type=range]
feat(input): add support for input[type=range]
feat(input): add support for binding to input[type=range]
feat(input): add support for binding to input[type=range]
feat(input): add support for binding to input[type=range] (#14870)
feat(input): add support for binding to input[type=range]
sbaechler commentedon Jul 5, 2017
To summarize:
The bug has been fixed in version 1.5.9. But for it to work you have to add the attribute
ng-input-rangeto the input[type=range] element. This is not necessary for Angular.js 1.6.https://code.angularjs.org/1.5.9/docs/api/ng/input/input%5Brange%5D