-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(progress-spinner): coerce string values #7791
Conversation
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.
LGTM overall, a couple idea/questions.
@@ -86,6 +87,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements | |||
private _value: number; | |||
private readonly _baseSize = 100; |
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.
Should this be a module const
? Since it is only read during construction, and can't be modified?
@@ -121,7 +132,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements | |||
} | |||
set value(newValue: number) { | |||
if (newValue != null && this.mode === 'determinate') { | |||
this._value = Math.max(0, Math.min(100, newValue)); | |||
this._value = Math.max(0, Math.min(100, coerceNumberProperty(newValue))); |
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.
We created a clamp
method in MdProgressBar
for this, should we do similar here? Potentially moving clamp to a util?
If so it might be in a follow up PR, but thought I would throw it out there.
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.
We used to have a clamp function because it was used in a couple of places, but now it's only used once so it should be fine having it inline.
@crisbeto Add |
6317583
to
5defc78
Compare
5defc78
to
24a8062
Compare
Needs rebase. |
24a8062
to
41c5a2d
Compare
Rebased. |
Needs rebase |
Coerces any string values that are passed to `value`, `diameter` and `strokeWidth` to numbers. Fixes angular#7790.
41c5a2d
to
09b3afe
Compare
Rebased @josephperrott. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Coerces any string values that are passed to
value
,diameter
andstrokeWidth
to numbers.Fixes #7790.