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
When using mask directive with expression: separtor.N (for example: separator.0) with flag [leadZero]=true and using Angular Reactive Forms, a form control is changing it's type from number to string.
It's caused by the method _toNumber: It checks if it's a SEPARATOR expression and if leadZero is truthy.
Why is that? I think the form control type shouldn't be changed via mask. Especially by the SEPARATOR expression mask which should be always a number?
Is this a desired behaviour?
My problem is that if a user is typing for example 23 in an input, the control.valueChanges output is "23" string, but should be a number.
this.control.valueChanges.subscribe(console.log) // <--- displays "23" string instead of 23 number
Uh oh!
There was an error while loading. Please reload this page.
🐞 bug report
Is this a regression?
No
Description
When using mask directive with expression: separtor.N (for example: separator.0) with flag [leadZero]=true and using Angular Reactive Forms, a form control is changing it's type from number to string.
It's caused by the method _toNumber: It checks if it's a SEPARATOR expression and if leadZero is truthy.
Why is that? I think the form control type shouldn't be changed via mask. Especially by the SEPARATOR expression mask which should be always a number?
Is this a desired behaviour?
My problem is that if a user is typing for example 23 in an input, the control.valueChanges output is "23" string, but should be a number.
this.control.valueChanges.subscribe(console.log) // <--- displays "23" string instead of 23 number
🔬 Minimal Reproduction
🌍 Your Environment
Angular Version:
latest
The text was updated successfully, but these errors were encountered: