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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any way to do it with type as text? i.e type="text" instead of type as number
That is not the right way to do things but nevertheless you can find the answer here. (stackoverflow.com/questions/37435529/…). If you find this helpful please accept the answer :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.