-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Spinner does not set model to null when a min value is specified #3318
Comments
I can submit a pull request for this. Is the PrimeNG team willing to accept one? |
Sure you can create a PR about this after the review we can merge it. @battmanz |
@Mrtcndkn Thanks for getting back to me. The issue boils down to this block of code inside the if(val.trim() === '') {
value= this.min !== undefined ? this.min : null;
} I personally find it surprising that if the min were if(val.trim() === '') {
value= null;
} However, that would be a breaking change. So do you think I should add a new flag as an attribute (e.g. if(val.trim() === '') {
value= (!this.nullIfEmpty && this.min !== undefined) ? this.min : null;
} Bottom line: Do I need a flag or not? |
PR merged. |
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
http://plnkr.co/edit/ZMwNY1AzjUzVKVuBt50o?p=preview
Current behavior
If the spinner has a
min
value specified, then the model cannot be set tonull
.Expected behavior
Even with a
min
value, the model should be set tonull
if I clear out all the text.Minimal reproduction of the problem with instructions
min
value set).5
) into both inputs.0
automatically gets inserted).null
(as I want), but notice that the "bad number" is still set to0
. I don't want it to be zero, I want it to benull
.What is the motivation / use case for changing the behavior?
I need a nullable number field with a min value. Zero is a valid value, so I need
null
to indicate that there is no value.Please tell us about your environment:
Browser: Chrome 59, Firefox 54
Language: TypeScript 2.3.4
Node (for AoT issues):
node --version
= 7.10.0The text was updated successfully, but these errors were encountered: