Encountering an unusual scenario while using angularJs and input type="number". It seems that if the initial value of an input falls outside the specified min and max range, the value gets wiped out.
To better visualize the issue, I created a fiddle - http://jsfiddle.net/PK3QH/2/
Here's the HTML code snippet:
<div ng-controller="MyCtrl">
<input ng-model="bindData.SomeAmount" type="number" required="required" />
<br />
<input ng-model="bindData.SomeAmount" type="number" required="required"
min="2" max="10" />
</div>
And here's the accompanying JavaScript:
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.bindData = {
SomeAmount: 1
};
}
The first textbox works fine, however, in the second one the value doesn't display. The challenge is to maintain the value while ensuring it is within the specified range. Any suggestions on how to achieve this?