-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Conversation
ba98e9e
to
f93b09a
Compare
@@ -1647,7 +1647,8 @@ function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) { | |||
// IE11 doesn't set the el val correctly if the maxVal is greater than the element value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed this comment should say "less than" (instead of "greater than"), right?
@gkalpak Travis finally green, you may review this again :> |
|
||
// This initalizes the min/max value, so that non-support browsers validate with the correct | ||
// values during the initial $render | ||
changeFn(initialAttrValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialAttrValue
will be undefined for ngMin
/ngMax
. Is this intended?
It is not clear why this function would do different things for ngXyz
vs xyz
attributes. If this is intended, you could add a short comment explaining what is going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we really only need to set the element attribute if we have min / max and the browser supports range. I've removed the call to changeFn as its use isn't tested currently.
The actual issue is that all validators that are based on observation if interpolation or ngX attributes only set their values after a digest. That means when the input renders these validators' valuea aren't defined. When the observers fire we will validate again with the correct values but this causes the model to be unset if the value is invalid. Imo this should still count as initialization so that shouldn't happen. The other thing is that we validate too often (once for every observer).
I'll open an issue for part 1 of this.
LGTM |
…alues The interpolation directive only sets the actual element attribute value after a digest passed. That means previously, the min/max values on input range were not set when the first $render happened, so the browser would not adjust the input value according to min/max. This meant the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. Fixes angular#14982
Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support them at all.
1dfc7cb
to
250801c
Compare
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes #14982 PR (#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes angular#14982 PR (angular#14996) (reverted from commit b78539b)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes angular#14982 PR (angular#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes angular#14982 PR (angular#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes angular#14982 PR (angular#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes angular#14982 PR (angular#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes angular#14982 PR (angular#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes #14982 PR (#14996)
This commit fixes the handling of min/max, and removes support for ngMin/ngMax: min/max: Previously, interpolated min/max values on input range were not set when the first $render happens, because the interpolation directive only sets the actual element attribute value after a digest passes. That means that the browser would not adjust the input value according to min/max and the range input and model would not be initialzed as expected. With this change, input range will set the actual element attribute value during its own linking phase, as it is already available on the attrs argument passed to the link fn. ngMin/ngMax Since ng prefixed attributes do not set their corresponding element attribute, the range input would always have min = 0, and max = 100 (in supported browsers), regardless of the value in ngMin/ngMax. This is confusing and not very useful, so it's better to not support these attributes at all. The commit also fixes a test which used an interpolation inside an attribute that expects an expression. Fixes #14982 PR (#14996)
Will this fix be back-ported to older angular versions? |
@icorne - which versions did you have in mind? We have no plans to backport it further back than 1.5.x |
I'm having trouble figuring out where this was merged into. I'm working on 1.5.x, so that's what I'm interested in. I've tried upgrading from 1.5.5 to 1.5.9 but I still get the issue. |
Ahah! Right. OK, it didn't make it into 1.5.9, since that was primarily a security release. It will be in 1.5.10. |
Oops! I am so confused with all the rebasing we did last week that I forgot that we actually did put this in 1.5.9 :-) Thanks @gkalpak |
Please check if the PR fulfills these requirements
[ ] Docs have been added / updated (for bug fixes / features)Other information:
This PR fixes 1 bigger and 2 smaller issues:
The interpolation directive only sets the actual element attribute value after
a digest passed. That means previously the min/max values on input range were
not set when the first $render happened, so the browser would not adjust
the input value according to min/max. This meant the range input and model would
not be initialzed as expected.
With this change, input range will set the actual element attribute value during its own
linking phase, as it is already available on the attrs argument passed to the link fn.
Fixes #14982