-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the formControl value with mask applied? #948
Comments
I have the same problem. When I use FormBuilder (1) or patchValue (2), the values are not masked.
Html Template
|
I solve my problem. First, Its needed to declare decimalMarker.
Second, my server application send some numbers as strings. So I rewrote "mask.directive.ts" file and changed the line number 449 from This changes solved the problem for me. Hope this helps. |
@leandroneves-net |
I tried with the version 12.0.0. I did not try with 13.0.0 yet. For test propouses only, you can try #957 (applied on lnx-mask-test2 package for angular12.0.0). This is a test package and I will delete this soon. Best regards, Leandro |
@leandroneves-net |
Hey guys, fortunately I solved this problem, maybe not with an elegant way but it's working pretty good in my project, take a look: In HTML I added a variable to the input file, just like this:
In the component I declared a global variable to access the input variable, like this:
Hope it helps! |
* fix(mask.directive.ts): parse input as a number if maskvalue starts with 'separator' My server sends numeric values as javascrpt strings. So if separator mask is used the input string will be treated as a NumberValue. * fix(mask.directive.ts): test files for parse input as a number if maskvalue starts with 'separator' * fix(#948): updated changelog, up version Co-authored-by: leandro <[email protected]> Co-authored-by: Leandro Neves <[email protected]>
Hi @andrebrz @leandroneves-net Thank you that using ngx-mask. Please try version >=13.1.10 |
This causes follow-up issue #1042 Could this maybe be reverted, and people be expected to parse their numbers themselves? Or fix their backends so it doesn't send numbers as strings? ;) |
The mask is working fine to me, the problem is when I'm gonna get a formControl that has it's value masked from component the value doesn't came with mask... How to solve this?
tnx
The text was updated successfully, but these errors were encountered: