vendredi 22 novembre 2019

AngularJS prevent number input to add decimal values

I have the following input of type number:

<input class="number text-center" type="number" step="1" ng-model="item.formattedQuantity" ng-disabled="item.discount === '100.00'" ng-change="change(item)" ng-blur="blur(item)" min="0" />

What can I do to forbid users adding decimal values? I tried adding step=0.01 and ng-pattern ng-pattern="/^[0-9]+$/" but users could still place values like 1.5, 31.56, etc.

What can I do?

Aucun commentaire:

Enregistrer un commentaire