We are open to use value or ngValue and the only
difference between two is that the “value” is always “string”, where in “ngValue”
you can pass “object”.
In the below example, I limited to the age>45
then input field value should beset reset to zero/0 as per my custom scenario. You can update as per your.
Set
limit in input field AngularJs -
ng-value="(age > 45 ? age = 0 : age)"
And
<input type="text" ng-model="age" ng-maxlength="2" ng-pattern="/^[0-9]*$/" ng-value="(age > 45 ? age = 0 : age)"/>