Within my angular-material application, I have a validation field:
<input type="number" ng-model="myValue"
name="myValue"
min="0" max="100"
ng-pattern="/^[0-9]\d*(\.\d+)?$/" required>
Initially, it functions correctly. However, I now require the ability for users to input .75 and have it display as 0.75 instead.
The question is how can I implement this filter:
if( myValue.substring(0,1) == "." ){
myValue = "0" + myValue;
}
Prior to applying angular material's ng-pattern
and type="number"
validations.