Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(input): add support to input[type=range] #9715

Closed
wants to merge 1 commit into from

Conversation

cironunes
Copy link
Member

the input[type=range] behavior is the same of an input[type=number]
with min=0, max=100 and step=1 as defaults

Closes #5892, #8241, #7370

the input[type=range] behavior is the same of an input[type=number]
with min=0, max=100 and step=1 as defaults

Closes angular#5892, angular#8241, angular#7370
@cironunes
Copy link
Member Author

Looks like IE9 doesn't support input[type=range]. What should we do?

@caitp
Copy link
Contributor

caitp commented Oct 22, 2014

we could add support for input[type=range] as a third party module. It probably isn't good for core since IE... And I've had friends whove not had it available on the version of Chrome on their office PC, so yeah. It's not quite ubiquitous yet.

Then again, we do support date inputs, so maybe... @IgorMinar WDYT

@caitp caitp added this to the Backlog milestone Oct 22, 2014
@cironunes
Copy link
Member Author

@caitp a 3rd party module sounds pretty cool. Well, let's wait for @IgorMinar and see.

@Narretz Narretz self-assigned this Jun 18, 2015
Narretz pushed a commit to Narretz/angular.js that referenced this pull request Jul 5, 2016
the input[type=range] behavior is the same of an input[type=number]
with min=0, max=100 and step=1 as defaults

Closes angular#5892
Closes angular#9715
Narretz pushed a commit to Narretz/angular.js that referenced this pull request Jul 5, 2016
the input[type=range] behavior is the same of an input[type=number]
with min=0, max=100 and step=1 as defaults

Closes angular#5892
Closes angular#9715
Narretz pushed a commit to Narretz/angular.js that referenced this pull request Jul 29, 2016
Thanks to @cironunes for the initial implementation in angular#9715

Adds support for binding to input[range] with the following behavior / features:

- Like input[number], it requires the model to be a Number, and will set the model to a Number
- it supports setting the min/max values via the min/max and ngMin/ngMax attributes
- it follows the browser behavior of never allowing an invalid value. That means, when the browser
converts an invalid value (empty: null, undefined, false ..., out of bounds: greater than max, less than min)
to a valid value, the input will in turn set the model to this new valid value via $setViewValue.
-- this means a range input will never be required and never have a non-Number model value, once the
ngModel directive is initialized.
-- this behavior is supported when the model changes and when the min/max attributes change in a way
that prompts the browser to update the input value.
-- ngMin / ngMax do not prompt the browser to update the values, as they don't set the attribute values.
Instead, they will set the min / max errors when appropriate
- browsers that do not support input[range] (IE9) handle the input like a number input (with validation etc.)

Closes angular#5892
Closes angular#9715
Close angular#14870
Narretz added a commit to Narretz/angular.js that referenced this pull request Jul 29, 2016
Thanks to @cironunes for the initial implementation in angular#9715

Adds support for binding to input[range] with the following behavior / features:

- Like input[number], it requires the model to be a Number, and will set the model to a Number
- it supports setting the min/max values via the min/max and ngMin/ngMax attributes
- it follows the browser behavior of never allowing an invalid value. That means, when the browser
converts an invalid value (empty: null, undefined, false ..., out of bounds: greater than max, less than min)
to a valid value, the input will in turn set the model to this new valid value via $setViewValue.
-- this means a range input will never be required and never have a non-Number model value, once the
ngModel directive is initialized.
-- this behavior is supported when the model changes and when the min/max attributes change in a way
that prompts the browser to update the input value.
-- ngMin / ngMax do not prompt the browser to update the values, as they don't set the attribute values.
Instead, they will set the min / max errors when appropriate
- browsers that do not support input[range] (IE9) handle the input like a number input (with validation etc.)

Closes angular#5892
Closes angular#9715
Close angular#14870
Narretz added a commit that referenced this pull request Jul 29, 2016
Thanks to @cironunes for the initial implementation in #9715

Adds support for binding to input[range] with the following behavior / features:

- Like input[number], it requires the model to be a Number, and will set the model to a Number
- it supports setting the min/max values via the min/max and ngMin/ngMax attributes
- it follows the browser behavior of never allowing an invalid value. That means, when the browser
converts an invalid value (empty: null, undefined, false ..., out of bounds: greater than max, less than min)
to a valid value, the input will in turn set the model to this new valid value via $setViewValue.
-- this means a range input will never be required and never have a non-Number model value, once the
ngModel directive is initialized.
-- this behavior is supported when the model changes and when the min/max attributes change in a way
that prompts the browser to update the input value.
-- ngMin / ngMax do not prompt the browser to update the values, as they don't set the attribute values.
Instead, they will set the min / max errors when appropriate
- browsers that do not support input[range] (IE9) handle the input like a number input (with validation etc.)

Closes #5892
Closes #9715
Close #14870
Narretz added a commit that referenced this pull request Jul 29, 2016
Thanks to @cironunes for the initial implementation in #9715

Adds support for binding to input[range] with the following behavior / features:

- Like input[number], it requires the model to be a Number, and will set the model to a Number
- it supports setting the min/max values via the min/max and ngMin/ngMax attributes
- it follows the browser behavior of never allowing an invalid value. That means, when the browser
converts an invalid value (empty: null, undefined, false ..., out of bounds: greater than max, less than min)
to a valid value, the input will in turn set the model to this new valid value via $setViewValue.
-- this means a range input will never be required and never have a non-Number model value, once the
ngModel directive is initialized.
-- this behavior is supported when the model changes and when the min/max attributes change in a way
that prompts the browser to update the input value.
-- ngMin / ngMax do not prompt the browser to update the values, as they don't set the attribute values.
Instead, they will set the min / max errors when appropriate
- browsers that do not support input[range] (IE9) handle the input like a number input (with validation etc.)

Closes #5892
Closes #9715
Close #14870
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for the input type=range
4 participants