angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Add support for the input type=range

Open andybak opened this issue 12 years ago • 59 comments

Originally filed here: https://github.com/angular/angular.js/issues/1189

(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.

Discussed in the group: https://groups.google.com/forum/?fromgroups#!topic/angular/Ecjx2fo8Qvk

andybak avatar Jan 20 '14 09:01 andybak

We got hit by that as well. We found that simply adding 'range': numberInputType inside the inputType map fixed it:

var inputType = {
....
'number': numberInputType,
'range': numberInputType,

It's not clear if this is the correct fix.

godmar avatar Aug 29 '14 14:08 godmar

The fix you mentioned does work, and is the same as the proposed change in this PR. The only reason this hasn't been merged is due to my sloppy commits and lack of unit tests, which I've not had time to investigate and/or correct.

On Friday, August 29, 2014, godmar [email protected] wrote:

We got hit by that as well. We found that simply adding 'range': numberInputType inside the inputType map fixed it:

var inputType = { .... 'number': numberInputType,

'range': numberInputType,

It's not clear if this is the correct fix.

— Reply to this email directly or view it on GitHub https://github.com/angular/angular.js/issues/5892#issuecomment-53882335.

TylerEich avatar Aug 29 '14 14:08 TylerEich

Just to let you know, this is not working in IE; http://stackoverflow.com/questions/26251847/input-range-and-ng-change-not-working-in-ie/26252170#26252170

sgedda avatar Oct 08 '14 08:10 sgedda

+1

kunalnavhate avatar Nov 20 '14 17:11 kunalnavhate

+1

vladimirmartsul avatar Dec 04 '14 17:12 vladimirmartsul

+1

mmontag avatar Dec 14 '14 23:12 mmontag

+1

martinoss avatar Jan 19 '15 20:01 martinoss

+1

nagyzsolthun avatar Jan 30 '15 23:01 nagyzsolthun

+1

BackPacker777 avatar Feb 20 '15 19:02 BackPacker777

+1

cleftheris avatar Mar 12 '15 11:03 cleftheris

+1

cgruber0 avatar Mar 23 '15 16:03 cgruber0

+1

slavaschmidt avatar Mar 26 '15 20:03 slavaschmidt

+1

nicholasxjy avatar Mar 28 '15 08:03 nicholasxjy

+1

thomaswmanion avatar Apr 01 '15 23:04 thomaswmanion

+1

m00s avatar Apr 02 '15 09:04 m00s

+1

AnjirHossain avatar May 14 '15 04:05 AnjirHossain

+1

Yimiprod avatar Jun 03 '15 13:06 Yimiprod

+1

corysmc avatar Jun 15 '15 07:06 corysmc

+1

onemenny avatar Jun 28 '15 09:06 onemenny

+1

linvi avatar Jul 01 '15 09:07 linvi