0

I have an html file with input field

<input type="text" allow-decimal="true" allow-negative="false" ng-model="amount"

and i have a controller.js file with scope variables $scope.amount=40000; and have one more scope variable $scope.minAmount= 2000;

So, what i want to do is I want to restrict the user from entering any value below 2000. User should not be allowed to enter anything below the value 2000.

can anyone help me with this?

Vinay
  • 1
  • 2

1 Answers1

0

You can set attributes max and min for maximum and minimum values inside an input element in html itself

<input type="number" name="id" min="2000">

This will set the minimum value for input as 2000. Similarly you can set a maximum value using max attribute.

thenaamsake
  • 264
  • 3
  • 12
  • Is there any way to do it with type as text? i.e type="text" instead of type as number – Vinay Sep 25 '20 at 14:32
  • That is not the right way to do things but nevertheless you can find the answer here. (https://stackoverflow.com/questions/37435529/proper-way-to-restrict-text-input-values-e-g-only-numbers). If you find this helpful please accept the answer :) – thenaamsake Sep 25 '20 at 14:50