currently I have the following code
it comes out to something like this
Try this:
null
and negitive
values. <input
type="number"
min="0"
(input)="funcCall()" -- Optional
oninput="value == '' ? value = 0 : value < 0 ? value = value * -1 : false"
formControlName="RateQty"
[(value)]="some.variable" -- Optional
/>
<input type="number" min="1" step="1">
Add a min attribute
<input type="number" min="0">
I have found another solution to prevent negative number.
<input type="number" name="test_name" min="0" oninput="validity.valid||(value='');">
It depends on how precise you want to be. It you want to accept only integers, than:
<input type="number" min="1" step="1">
If you want floats with, for example, two digits after decimal point:
<input type="number" min="0.01" step="0.01">