Incorrect value using angular form builder
See original GitHub issueExample:
this.form = this.formBuilder.group({
value: [4500, [Validators.required]],
});
Should return: R$ 45,00 It’s returning: R$ 4.500,00
My configs:
export const customCurrencyMaskConfig = {
align: "left",
allowNegative: true,
allowZero: true,
decimal: ",",
precision: 2,
prefix: "R$ ",
suffix: "",
thousands: ".",
nullable: true,
min: null,
max: null,
inputMode: CurrencyMaskInputMode.FINANCIAL,
};
Am I missing something? Thank you.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Angular 5 FormBuilder errors undefined when invalid input
Running the app: shows the formbuilder in the ts below initializes the input field correctly and if I add the [disabled] expression commented ......
Read more >Validating form input - Angular
Every time the value of a form control changes, Angular runs validation and generates either a list of validation errors that results in...
Read more >Valid and Invalid in Angular Forms | by Garen Stepanyan
In Angular one of most common ways to validate forms is to disable the submit button. It's a nice way (alongside with helpful...
Read more >5 tips on using Angular FormControl | by Alain Chautard
valueChanges — Emits all value updates as soon as they happen · statusChanges — Emits all status updates (VALID or INVALID) as the...
Read more >Show Validation Error Messages for Reactive Forms in ...
Show Validation Error Messages for Reactive Forms in Angular 9 · Show the Field is Required Using the Label · Show the Validation...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yeah, I did understand. The issue is that my entire database monetary values are integers. So in my database I do save 4500 for R$ 45,00.
I think that some projects also save integers for monetary values and maybe this lib should have an option to accept integers when using FINANCIAL type.
Thank you!
I too would like to see an integers option. As my data stored for monetary values are stored in whole pence (integers) - Alot of merchant and payment platforms work in integers to avoid rounding errors.
In my example
<input class="input input-price" currencyMask [(ngModel)]="value.price" [options]="{ prefix: '£ ', thousands: '.', decimal: '.', allowNegative: false }"" >value.price = 650 displays = £650.00 Form Value = 650
type into input = 650 displays = £6.50 Form Value = 650