primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Updating minFractionDigits and maxFractionDigits results in error

Open AndreiVajnaII opened this issue 6 years ago • 1 comments

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior When both minFractionDigits and maxFractionDigits are changed for an InputNumber, it results in an error:

Error: maximumFractionDigits value is out of range.

Expected behavior No error should occur and the InputNumber should be formatted using the new settings.

Minimal reproduction of the problem with instructions Use a InputNumber with format set to true and both minFractionDigits and maxFractionDigtis set to 1. Update both faction digits to 2, for example on a button click.

See the demo: https://stackblitz.com/edit/github-gchfwb?devtoolsheight=33&file=src/app/app.component.ts

Just click on the "Change" button and see the console.

Please tell us about your environment:

  • Angular version: 10.0.14
  • PrimeNG version: 10.0.3

AndreiVajnaII avatar Oct 29 '20 10:10 AndreiVajnaII

+1 The problem seems to be that the setter of minFractionDigits calls this.updateConstructParser() right away, i.e. with the "old" maxFractionDigtis value still in place: https://github.com/primefaces/primeng/blob/master/src/app/components/inputnumber/inputnumber.ts#L229 (guessing ... detect using OnChanges instead of setters ?)

drml avatar Mar 08 '21 14:03 drml