I have a form it includes input field which you can enter the amount of money. It has max attr. and if user entered amount of money greater than the max value I would like to set the ng-model parameter value to set max value which is the response of a RESTFull API.
Directly assigned the JSON object value to max attribute. The max value is typed in string as a response of API.
I used currency filters while assigning of the attribute values.
How to set max attribute value to ngModel object's value? If user enters the greater value than max value? Is there a way to change it immidiately and update the input field at the same time?
Also please tell me, If I'm using filters true? or NOT?
<input type="text" name="payableamount" class="form-control input-lg"
min="{{amount | currency:'':2}}"
max="{{billObj.amount | currency:'':2}}"
ng-model="form.bidAmount"
ng-required="true" ui-number-mask>
Store the value of maxAmount which you got from API and validate it inside the 'checkAmount' function
1.Using ngKeyup:
2. Using Directive,
Fiddle (using ng-keyup) : http://jsfiddle.net/r74a5m25/202/
Fiddle (using directive) : http://jsfiddle.net/r74a5m25/203/